|
|
@@ -2,6 +2,9 @@
|
|
|
|
|
|
namespace App\Module\Fund\Models;
|
|
|
|
|
|
+use App\Module\Fund\Enums\FUND_TYPE;
|
|
|
+use App\Module\Fund\Enums\LOG_TYPE;
|
|
|
+use App\Module\Fund\Enums\OPERATE_TYPE;
|
|
|
use App\Module\User\Models\User;
|
|
|
use App\Module\User\Models\UserInfo;
|
|
|
use UCore\ModelCore;
|
|
|
@@ -11,26 +14,27 @@ use UCore\ModelCore;
|
|
|
* App\Module\Fund\Models\FundLogModel
|
|
|
* 资金日志表
|
|
|
* field start
|
|
|
- * @property int $id
|
|
|
- * @property int $user_id 用户ID
|
|
|
- * @property int $fund_id 资金id
|
|
|
- * @property int $amount 操作金额,正值为收入,负值为支出
|
|
|
- * @property string $operate_id 上游操作id
|
|
|
- * @property string $operate_type 上游操作类型
|
|
|
- * @property string $remark 备注
|
|
|
- * @property int $create_time 最后更新时间
|
|
|
- * @property string $create_ip 最后更新ip
|
|
|
- * @property int $later_balance 在此之后的余额
|
|
|
- * @property int $before_balance 在此之前的月
|
|
|
- * @property int $date_key 月份key
|
|
|
- * @property string $hash 防篡改哈希值
|
|
|
- * @property string $prev_hash 上一条记录的哈希值
|
|
|
+ *
|
|
|
+ * @property int $id
|
|
|
+ * @property int $user_id 用户ID
|
|
|
+ * @property int $fund_id 资金id
|
|
|
+ * @property int $amount 操作金额,正值为收入,负值为支出
|
|
|
+ * @property string $operate_id 上游操作id
|
|
|
+ * @property string $operate_type 上游操作类型
|
|
|
+ * @property string $remark 备注
|
|
|
+ * @property int $create_time 最后更新时间
|
|
|
+ * @property string $create_ip 最后更新ip
|
|
|
+ * @property int $later_balance 在此之后的余额
|
|
|
+ * @property int $before_balance 在此之前的月
|
|
|
+ * @property int $date_key 月份key
|
|
|
+ * @property string $hash 防篡改哈希值
|
|
|
+ * @property string $prev_hash 上一条记录的哈希值
|
|
|
* field end
|
|
|
*/
|
|
|
class FundLogModel extends ModelCore
|
|
|
{
|
|
|
|
|
|
- protected $table = 'fund_logs';
|
|
|
+ protected $table = 'fund_logs';
|
|
|
|
|
|
// attrlist start
|
|
|
protected $fillable = [
|
|
|
@@ -50,10 +54,13 @@ class FundLogModel extends ModelCore
|
|
|
'prev_hash',
|
|
|
];
|
|
|
// attrlist end
|
|
|
- public $timestamps = false;
|
|
|
-
|
|
|
+ public $timestamps = false;
|
|
|
|
|
|
|
|
|
+ protected $casts = [
|
|
|
+ 'fund_id' => FUND_TYPE::class,
|
|
|
+ 'operate_type' => LOG_TYPE::class
|
|
|
+ ];
|
|
|
|
|
|
public function user()
|
|
|
{
|
|
|
@@ -61,7 +68,6 @@ class FundLogModel extends ModelCore
|
|
|
}
|
|
|
|
|
|
|
|
|
-
|
|
|
/**
|
|
|
* 生成记录的哈希值
|
|
|
* SHA-256 输出为 64 位十六进制字符串
|
|
|
@@ -103,8 +109,9 @@ class FundLogModel extends ModelCore
|
|
|
])->orderBy('id', 'desc')->first();
|
|
|
}
|
|
|
|
|
|
- public static function addLog($userId,$fundId,$amount,)
|
|
|
+ public static function addLog($userId, $fundId, $amount)
|
|
|
{
|
|
|
|
|
|
}
|
|
|
+
|
|
|
}
|