初始版本
This commit is contained in:
77
server/app/common/logic/CoachAccountLogLogic.php
Executable file
77
server/app/common/logic/CoachAccountLogLogic.php
Executable file
@@ -0,0 +1,77 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | likeshop100%开源免费商用商城系统
|
||||
// +----------------------------------------------------------------------
|
||||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||||
// | 开源版本可自由商用,可去除界面版权logo
|
||||
// | 商业版本务必购买商业授权,以免引起法律纠纷
|
||||
// | 禁止对系统程序代码以任何目的,任何形式的再发布
|
||||
// | gitee下载:https://gitee.com/likeshop_gitee
|
||||
// | github下载:https://github.com/likeshop-github
|
||||
// | 访问官网:https://www.likeshop.cn
|
||||
// | 访问社区:https://home.likeshop.cn
|
||||
// | 访问手册:http://doc.likeshop.cn
|
||||
// | 微信公众号:likeshop技术社区
|
||||
// | likeshop团队 版权所有 拥有最终解释权
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeshopTeam
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\common\logic;
|
||||
|
||||
use app\common\enum\accountLog\AccountLogEnum;
|
||||
use app\common\enum\accountLog\CoachAccountLogEnum;
|
||||
use app\common\model\accountLog\AccountLog;
|
||||
use app\common\model\accountLog\CoachAccountLog;
|
||||
use app\common\model\coach\Coach;
|
||||
use app\common\model\user\User;
|
||||
|
||||
class CoachAccountLogLogic extends BaseLogic
|
||||
{
|
||||
/**
|
||||
* @notes 添加账户流水记录
|
||||
* @param $userId //会员ID
|
||||
* @param $changeObject //变动对象
|
||||
* @param $changeType //变动类型
|
||||
* @param $action //变动动作
|
||||
* @param $changeAmount //变动数量
|
||||
* @param string $associationSn //关联单号
|
||||
* @param string $remark //备注
|
||||
* @param array $feature //预留字段,方便存更多其它信息
|
||||
* @return bool
|
||||
* @author ljj
|
||||
* @date 2022/10/28 5:15 下午
|
||||
*/
|
||||
public static function add($coachId, $changeObject, $changeType, $action, $changeAmount, $associationSn = '', $adminId = '',$remark = '', $feature = [])
|
||||
{
|
||||
// 取用户信息
|
||||
$coach = (new Coach())->findOrEmpty($coachId);
|
||||
if ($coach->isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
// 取变动对象
|
||||
// $changeObject = CoachAccountLogEnum::getChangeTypeDesc($changeType);
|
||||
// if (!$changeObject) {
|
||||
// return false;
|
||||
// }
|
||||
$leftAmount = $coach->money;
|
||||
if(in_array($changeType,CoachAccountLogEnum::DEPOSIT_DESC)){
|
||||
$leftAmount = $coach->deposit;
|
||||
}
|
||||
$data = [
|
||||
'sn' => generate_sn((new CoachAccountLog()), 'sn', 20),
|
||||
'coach_id' => $coachId,
|
||||
'change_object' => $changeObject,
|
||||
'change_type' => $changeType,
|
||||
'action' => $action,
|
||||
'left_amount' => $leftAmount,
|
||||
'change_amount' => $changeAmount,
|
||||
'association_sn'=> $associationSn,
|
||||
'remark' => $remark,
|
||||
'feature' => $feature ? json_encode($feature, JSON_UNESCAPED_UNICODE) : '',
|
||||
'admin_id' => $adminId
|
||||
];
|
||||
CoachAccountLog::create($data);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user