| 12345678910111213141516171819202122232425262728293031323334353637383940 |
- <?php
- namespace app\admin\model;
- use app\BaseModel;
- class KefuLog extends BaseModel
- {
-
- // protected $autoWriteTimestamp = true;
- // protected $createTime = 'created_at';
- // protected $updateTime = 'updated_at';
- //客服对接记录表:type:类型:1主动接线;2转接接线;3自动接线
- public static function addData($cs_uid, $user_id, $type) {
- //先结束已存在的记录
- self::endData($user_id);
- return self::create([
- 'cs_uid' => $cs_uid,
- 'user_id' => $user_id,
- 'type' => $type,
- 'status' => 0,
- 'created_at' => date('Y-m-d H:i:s')
- ]);
- }
- //客服对接结束
- public static function endData($user_id) {
-
- $info = self::where('user_id', $user_id)->where('status', 0)->find();
- if ($info) {
- $info->status = 1;
- $info->updated_at = date('Y-m-d H:i:s');
- $info->save();
- }
- }
- }
|