*/ class PromoteCoinRecordModel extends Model { const TYPE_RECHARGE = 1; const TYPE_CONSUME = 2; protected $tablePrefix = 'tab_'; public static $subTypes = [ 1 => '平台充值', 2 => '线下转账', 3 => '转账充值', 4 => '转账消费', ]; public function addRecord($params) { $data = [ 'sn' => '', 'type' => 1, 'sub_type' => 1, 'promote_id' => $fromPromoteId, 'ref_id' => $refId, 'target_type' => $toPromote['id'], 'coin' => $num, 'balance_coin' => $fromPromote['balance_coin'] + $num, 'create_time' => time(), 'description' => '平台币转账', 'remark' => $remark, ]; $data = $this->create($data); $res = $this->add($data); return $res; } }