|
- <?php
- /**
- * 数据库表类 fx_user_amount_log
- * ============================================================================
- * * 版权所有 蜘蛛出行 * *
- * 网站地址: http://www.zhizhuchuxing.com
- * ----------------------------------------------------------------------------
- * 这不是一个自由软件!您只能在不用于商业目的的前提下对程序代码进行修改和
- * 使用;不允许对程序代码以任何形式任何目的的再发布。
- * ============================================================================
- * Author By: 倪宗锋
- * PhpStorm LoginController.php
- * Create By 2017/06/16 10:22 $
- */
-
- namespace common\models;
-
- use common\util\Util;
- use yii\db\ActiveRecord;
-
- /**
- * 数据库表类 fx_user_amount_log.
- * @property integer $log_id
- * @property integer $fx_uid
- * @property integer $trade_type
- * @property integer $amount
- * @property integer $remaining_sum
- * @property string $msg
- * @property string $create_time
- * @property string $update_time
- */
- class FxUserAmountLog extends ActiveRecord
- {
- /**
- * @inheritdoc
- */
- public static function tableName()
- {
- return 'fx_user_amount_log';
- }
-
- /**
- * @inheritdoc
- */
- public function rules()
- {
- return [
- [['fx_uid', 'trade_type', 'amount', 'remaining_sum'], 'required'],
- [['fx_uid', 'trade_type'], 'integer'],
- [['amount', 'remaining_sum'], 'number'],
- [['create_time', 'update_time'], 'safe'],
- [['msg'], 'string', 'max' => 255],
- ];
- }
-
- /**
- * @inheritdoc
- */
- public function attributeLabels()
- {
- return [
- 'log_id' => 'Log ID',
- 'fx_uid' => 'Fx Uid',
- 'trade_type' => 'Trade Type',
- 'amount' => 'Amount',
- 'remaining_sum' => 'Remaining Sum',
- 'msg' => 'Msg',
- 'create_time' => 'Create Time',
- 'update_time' => 'Update Time',
- ];
- }
-
- /**
- * Des:添加记录
- * Name: addLog
- * @param $fx_uid
- * @param $trade_type
- * @param $amount
- * @param $remaining_sum
- * @param $msg
- * @return array
- * @author 倪宗锋
- */
- public function addLog($fx_uid, $trade_type, $amount, $remaining_sum, $msg)
- {
- $param = [
- 'fx_uid' => $fx_uid,
- 'amount' => $amount,
- 'trade_type' => $trade_type,
- 'remaining_sum' => $remaining_sum,
- 'create_time' => date('Y-m-d H:i:s'),
- 'msg' => $msg
- ];
- $this->attributes = $param;
- $insertFlag = $this->insert();
- if (!$insertFlag) {
- return Util::returnArrEr('add amount_log fail!');
- }
- return Util::returnArrSu();
- }
- }
|