ThinkSSL🔒 一键申购 5分钟快速签发 30天无理由退款 购买更放心 广告
### 写入时尚顾问服务客户的记录 **位置:** Common\Lib\CustomerLib.class.php **参数:** @param $service 说明: 参数数组包含3个项, $service['sale_uid'] 时尚顾问ID $service['cid'] 客户ID(选填) $service['open_id'] 客户open_id(选填) $service['type'] 关系类型:1.POS订单2.商城订单3.客户点击分享的链接4.CRM添加客户5.客户扫码注册 $service['remarks'] 备注(选填) 客户ID和客户open_id至少有一个不为空 调用时根据需要组合$service数组 **调用:** * 组件文件外调用 ~~~ // 写入服务记录 $data_rel['sale_uid'] = $sale_uid; // 时尚顾问 $data_rel['open_id'] = $_SESSION['login_data']['open_id']; // 客户的open_id $data_rel['type'] = 3; // 客户点击后台用户分享的链接 $my_cus = new CustomerLib(); // 实例化组件库 $res_rel = $my_cus->addCustomerService($data_rel); ~~~ **返回:** 成功时返回 true 失败时候返回 对应的错误码 **完整代码:** ~~~ /** * @param $service * 参数数组包含3个项, * $service['sale_uid'] 时尚顾问ID * $service['cid'] 客户ID(选填) * $service['open_id'] 客户open_id(选填) * $service['type'] 关系类型:1.POS订单2.商城订单3.客户点击分享的链接4.CRM添加客户5.客户扫码注册 * $service['remarks'] 备注(选填) * 客户ID和客户open_id至少有一个不为空 * 调用时根据需要组合$service数组 * @return bool */ public function addCustomerService($service) { if (empty($service['sale_uid'])) { return array('success' => false, 'code' => -1, 'msg'=> '时尚顾问ID不能为空!'); } if (empty($service['cid']) && empty($service['open_id'])) { return array('success' => false, 'code' => -2, 'msg'=> '客户ID和客户open_id至少有一个不为空!'); } if (empty($service['type'])) { return array('success' => false, 'code' => -3, 'msg'=> '关系类型不能为空!'); } $service['customer_ip'] = get_client_ip(); // 获取客户端IP $service['create_time'] = time(); // 创建时间 // 将日志数组信息插入订单日志表 $res_log = M('customer_service')->add($service); if (!$res_log) { return array('success' => false, 'code' => -4, 'msg'=> '插入数据操作失败!'); } return array('success' => true, 'code' => 200, 'msg' => '服务记录插入成功!' ); } ~~~