Nie możesz wybrać więcej, niż 25 tematów Tematy muszą się zaczynać od litery lub cyfry, mogą zawierać myślniki ('-') i mogą mieć do 35 znaków.
 
 
 
 
 
 

102 wiersze
2.7 KiB

  1. <?php
  2. /**
  3. * 数据库表类 fx_user_amount_log
  4. * ============================================================================
  5. * * 版权所有 蜘蛛出行 * *
  6. * 网站地址: http://www.zhizhuchuxing.com
  7. * ----------------------------------------------------------------------------
  8. * 这不是一个自由软件!您只能在不用于商业目的的前提下对程序代码进行修改和
  9. * 使用;不允许对程序代码以任何形式任何目的的再发布。
  10. * ============================================================================
  11. * Author By: 倪宗锋
  12. * PhpStorm LoginController.php
  13. * Create By 2017/06/16 10:22 $
  14. */
  15. namespace common\models;
  16. use common\util\Util;
  17. use yii\db\ActiveRecord;
  18. /**
  19. * 数据库表类 fx_user_amount_log.
  20. * @property integer $log_id
  21. * @property integer $fx_uid
  22. * @property integer $trade_type
  23. * @property integer $amount
  24. * @property integer $remaining_sum
  25. * @property string $msg
  26. * @property string $create_time
  27. * @property string $update_time
  28. */
  29. class FxUserAmountLog extends ActiveRecord
  30. {
  31. /**
  32. * @inheritdoc
  33. */
  34. public static function tableName()
  35. {
  36. return 'fx_user_amount_log';
  37. }
  38. /**
  39. * @inheritdoc
  40. */
  41. public function rules()
  42. {
  43. return [
  44. [['fx_uid', 'trade_type', 'amount', 'remaining_sum'], 'required'],
  45. [['fx_uid', 'trade_type'], 'integer'],
  46. [['amount', 'remaining_sum'], 'number'],
  47. [['create_time', 'update_time'], 'safe'],
  48. [['msg'], 'string', 'max' => 255],
  49. ];
  50. }
  51. /**
  52. * @inheritdoc
  53. */
  54. public function attributeLabels()
  55. {
  56. return [
  57. 'log_id' => 'Log ID',
  58. 'fx_uid' => 'Fx Uid',
  59. 'trade_type' => 'Trade Type',
  60. 'amount' => 'Amount',
  61. 'remaining_sum' => 'Remaining Sum',
  62. 'msg' => 'Msg',
  63. 'create_time' => 'Create Time',
  64. 'update_time' => 'Update Time',
  65. ];
  66. }
  67. /**
  68. * Des:添加记录
  69. * Name: addLog
  70. * @param $fx_uid
  71. * @param $trade_type
  72. * @param $amount
  73. * @param $remaining_sum
  74. * @param $msg
  75. * @return array
  76. * @author 倪宗锋
  77. */
  78. public function addLog($fx_uid, $trade_type, $amount, $remaining_sum, $msg)
  79. {
  80. $param = [
  81. 'fx_uid' => $fx_uid,
  82. 'amount' => $amount,
  83. 'trade_type' => $trade_type,
  84. 'remaining_sum' => $remaining_sum,
  85. 'create_time' => date('Y-m-d H:i:s'),
  86. 'msg' => $msg
  87. ];
  88. $this->attributes = $param;
  89. $insertFlag = $this->insert();
  90. if (!$insertFlag) {
  91. return Util::returnArrEr('add amount_log fail!');
  92. }
  93. return Util::returnArrSu();
  94. }
  95. }