createRecord($params); return M('PromoteCoinRecord', 'tab_')->add($data); } public function createRecord($params) { $sn = date('YmdHis').strtoupper(substr(md5(json_encode($params) . 'PromoteCoinRecord' . rand(0, 99999)), 8, 16)); $data = [ 'sn' => $sn, 'type' => $params['type'], 'sub_type' => $params['sub_type'], 'ref_id' => $params['ref_id'], 'target_id' => $params['target_id'], 'target_type' => $params['target_type'], 'coin' => $params['coin'], 'balance_coin' => $params['balance_coin'], 'create_time' => isset($params['create_time']) ? $params['create_time'] : time(), 'description' => $params['description'], 'remark' => isset($params['remark']) ? $params['remark'] : '', ]; return $data; } }