| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132 |
- <?php
- namespace App\Models\Api\Process;
- use Illuminate\Database\Eloquent\Factories\HasFactory;
- use Illuminate\Database\Eloquent\Model;
- use Illuminate\Support\Facades\DB;
- /**
- * 违规处理-违规商品处理人员关系模型
- * @author: 唐远望
- * @version: 1.0
- * @date: 2025-12-10
- */
- class ViolationStoreMember extends Model
- {
- use HasFactory;
- // 与模型关联的表名
- protected $table = 'process_violation_store_member';
- // 是否主动维护时间戳
- public $timestamps = false;
- // 定义时间戳字段名
- // const CREATED_AT = 'insert_time';
- // const UPDATED_AT = 'update_time';
- /**
- * 添加
- * @author 唐远望
- * @version 1.0
- * @date 2025-12-10
- */
- public function addViolationStoreMember_content($data)
- {
- $insert_data = [
- 'violation_store_logid' => $data['violation_store_logid'],
- 'employee_id' => $data['employee_id'],
- 'duty_type' => $data['duty_type'],
- ];
- $ViolationStoreMember_id = $this->insertGetId($insert_data);
- return $ViolationStoreMember_id;
- }
- /**
- * 写入数据
- * @author 唐远望
- * @version 1.0
- * @date 2025-12-10
- * @param $data
- * @return bool
- */
- public function addViolationStoreMember($data)
- {
- DB::beginTransaction();
- try {
- $this->addViolationStoreMember_content($data);
- DB::commit();
- return true;
- // 成功处理...
- } catch (\Exception $e) {
- DB::rollBack();
- // 错误处理...
- return false;
- }
- }
- /**
- * 编辑内容
- * @author 唐远望
- * @version 1.0
- * @date 2025-12-10
- * @param $data
- * @return bool
- */
- public function editViolationStoreMember_content($where, $data)
- {
- $ViolationStoreMember = $this->where($where)->first();
- if (!$ViolationStoreMember) {
- return false;
- }
- $ViolationStoreMember->violation_store_logid = $data['violation_store_logid'];
- $ViolationStoreMember->employee_id = $data['employee_id'];
- $ViolationStoreMember->duty_type = $data['duty_type'];
- $ViolationStoreMember->save();
- return true;
- }
- /**
- * 更新数据
- * @author 唐远望
- * @version 1.0
- * @date 2025-12-10
- * @param $data
- * @return bool
- */
- public function updateViolationStoreMember($where, $data)
- {
- DB::beginTransaction();
- try {
- $this->editViolationStoreMember_content($where, $data);
- DB::commit();
- return true;
- // 成功处理...
- } catch (\Exception $e) {
- DB::rollBack();
- // 错误处理...
- return false;
- }
- }
- /**
- * 删除数据
- * @author 唐远望
- * @version 1.0
- * @date 2025-12-10
- * @param $id
- * @return bool
- */
- public function deleteViolationStoreMember($where)
- {
- $ViolationStoreMember = $this->where($where)->first();
- if (!$ViolationStoreMember) {
- return false;
- }
- $ViolationStoreMember->delete();
- return true;
- }
- }
|