|
|
@ -311,6 +311,95 @@ class CustomerResourcesService extends BaseApiService |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
//客户资源(学生个人资料)-编辑 |
|
|
|
|
|
public function editInfo(array $where, array $data) |
|
|
|
|
|
{ |
|
|
|
|
|
|
|
|
|
|
|
$res = [ |
|
|
|
|
|
'code' => 0, |
|
|
|
|
|
'msg' => '操作失败', |
|
|
|
|
|
'data' => [] |
|
|
|
|
|
]; |
|
|
|
|
|
|
|
|
|
|
|
if (!$where) { |
|
|
|
|
|
$res['msg'] = '查询条件不能为空'; |
|
|
|
|
|
return $res; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
$customer_resources_data = [ |
|
|
|
|
|
'name' => $data['name'], // 姓名 |
|
|
|
|
|
'gender' => $data['gender'], // 性别(male:男, female:女) |
|
|
|
|
|
'age' => $data['age'], // 年龄 |
|
|
|
|
|
'phone_number' => $data['phone_number'], // 手机号 |
|
|
|
|
|
]; |
|
|
|
|
|
|
|
|
|
|
|
$date = date('Y-m-d H:i:s'); |
|
|
|
|
|
$customer_resources_data['updated_at'] = $date; |
|
|
|
|
|
|
|
|
|
|
|
//开启事物 |
|
|
|
|
|
Db::startTrans(); |
|
|
|
|
|
try { |
|
|
|
|
|
$customer_resources = CustomerResources::where('member_id', $where['member_id'])->find(); |
|
|
|
|
|
|
|
|
|
|
|
if ($customer_resources) { |
|
|
|
|
|
$customer_resources = $customer_resources->toArray(); |
|
|
|
|
|
} |
|
|
|
|
|
$update_1 = CustomerResources::where('id', $customer_resources['id'])->update($customer_resources_data);//客户资源表 |
|
|
|
|
|
if (!$update_1) { |
|
|
|
|
|
Db::rollback(); |
|
|
|
|
|
return $res; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
//更新学生账户登录表 |
|
|
|
|
|
$member_data = [ |
|
|
|
|
|
'username'=>$data['phone_number'], |
|
|
|
|
|
'mobile'=>$data['phone_number'], |
|
|
|
|
|
'update_time'=>time() |
|
|
|
|
|
]; |
|
|
|
|
|
if(!empty($data['headimg'])){ |
|
|
|
|
|
$member_data['headimg'] = $data['headimg']; |
|
|
|
|
|
} |
|
|
|
|
|
$update_member = Member::where('member_id', $where['member_id'])->update($member_data); |
|
|
|
|
|
if(!$update_member){ |
|
|
|
|
|
Db::rollback(); |
|
|
|
|
|
return $res; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//更近客户资源日志表 |
|
|
|
|
|
$compareData = (new CommonService)->compareData($customer_resources, $customer_resources_data); |
|
|
|
|
|
if ($compareData['changed_fields']) { |
|
|
|
|
|
$data = [ |
|
|
|
|
|
"customer_resource_id" => $customer_resources['id'],//客户资源的ID |
|
|
|
|
|
"operator_id" => 0,//操作人的ID |
|
|
|
|
|
"campus_id" => 0,//操作人校区的ID|如果这人有2校区就填0 |
|
|
|
|
|
"modified_fields" => $compareData['changed_fields_json'],//修改的哪些字段 |
|
|
|
|
|
"old_values" => $compareData['old_values_json'],//修改前的值 |
|
|
|
|
|
"new_values" => $compareData['new_values_json'],//修改后的值 |
|
|
|
|
|
]; |
|
|
|
|
|
|
|
|
|
|
|
$id = CustomerResourceChanges::insertGetId($data); |
|
|
|
|
|
if (!$id) { |
|
|
|
|
|
Db::rollback(); |
|
|
|
|
|
return $res; |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Db::commit(); |
|
|
|
|
|
$res = [ |
|
|
|
|
|
'code' => 1, |
|
|
|
|
|
'msg' => '操作成功' |
|
|
|
|
|
]; |
|
|
|
|
|
return $res; |
|
|
|
|
|
} catch (\Exception $exception) { |
|
|
|
|
|
Db::rollback(); |
|
|
|
|
|
return $res; |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
//客户资源-获取客户资源修改记录列表 |
|
|
//客户资源-获取客户资源修改记录列表 |
|
|
public function getCustomerResourceChangesEditLog(array $where) |
|
|
public function getCustomerResourceChangesEditLog(array $where) |
|
|
{ |
|
|
{ |
|
|
|