1234567891011121314151617181920212223242526272829303132333435363738394041 |
- <?php
- namespace app\common\model;
- use think\Model;
- class UserSoundcoinLog extends Model
- {
-
- protected $autoWriteTimestamp = 'int';
-
- protected $createTime = 'createtime';
-
- public function addUserSoundcoinLog($user_id, $money, $mode, $before, $detail, $type = 1, $objId = 0)
- {
- if ($mode == "+") {
- $balance = $before + $money;
- } else {
- $balance = $before - $money;
- }
-
- $data = [];
- $data["user_id"] = $user_id;
- $data['type'] = $type;
- $data['obj_id'] = $objId;
- $data["value"] = $money;
- $data["mode"] = $mode;
- $data["before"] = $before;
- $data["balance"] = $balance;
- $data["detail"] = $detail;
- $data["createtime"] = time();
- return $this->insertGetId($data);
- }
- }
|