KefuLog.php 958 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. <?php
  2. namespace app\admin\model;
  3. use app\BaseModel;
  4. class KefuLog extends BaseModel
  5. {
  6. // protected $autoWriteTimestamp = true;
  7. // protected $createTime = 'created_at';
  8. // protected $updateTime = 'updated_at';
  9. //客服对接记录表:type:类型:1主动接线;2转接接线;3自动接线
  10. public static function addData($cs_uid, $user_id, $type) {
  11. return self::create([
  12. 'cs_uid' => $cs_uid,
  13. 'user_id' => $user_id,
  14. 'type' => $type,
  15. 'status' => 0,
  16. 'created_at' => date('Y-m-d H:i:s')
  17. ]);
  18. }
  19. //客服对接结束
  20. public static function endData($cs_uid, $user_id) {
  21. $info = self::where('cs_uid', $cs_uid)->where('user_id', $user_id)->where('status', 0)->find();
  22. if ($info) {
  23. $info->status = 1;
  24. $info->updated_at = date('Y-m-d H:i:s');
  25. $info->save();
  26. }
  27. }
  28. }