| 1234567891011121314151617181920212223242526 |
- <?php
- namespace app\admin\model;
- use app\BaseModel;
- class KefuWork extends BaseModel
- {
- protected $autoWriteTimestamp = true;
- protected $createTime = 'created_at';
- protected $updateTime = 'updated_at';
-
- public static function addNum($admin_id, $field) {
- $info = self::where('admin_id', $admin_id)->where("created_at", '>=', date("Y-m-d"))->find();
- if (!$info) {
- $info = self::create([
- 'admin_id' => $admin_id,
- $field => 1,
- ]);
- } else {
- $info->$field += 1;
- $info->save();
- }
- return true;
- }
- }
|