62 lines
1.6 KiB
PHP
62 lines
1.6 KiB
PHP
<?php
|
||
|
||
// +----------------------------------------------------------------------
|
||
// | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
||
// +----------------------------------------------------------------------
|
||
// | Copyright (c) 2016~2022 https://www.crmeb.com All rights reserved.
|
||
// +----------------------------------------------------------------------
|
||
// | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
||
// +----------------------------------------------------------------------
|
||
// | Author: CRMEB Team <admin@crmeb.com>
|
||
// +----------------------------------------------------------------------
|
||
|
||
|
||
namespace app\common\repositories\user;
|
||
|
||
use app\common\dao\user\IntegralDao;
|
||
use app\common\repositories\BaseRepository;
|
||
|
||
/**
|
||
* Common: ...
|
||
* Author: wu-hui
|
||
* Time: 2023/11/07 10:34
|
||
* Class IntegralRepository
|
||
* @package app\common\repositories\user
|
||
*/
|
||
class IntegralRepository extends BaseRepository
|
||
{
|
||
/**
|
||
* @var IntegralDao
|
||
*/
|
||
protected $dao;
|
||
|
||
/**
|
||
* IntegralRepository constructor.
|
||
* @param IntegralDao $dao
|
||
*/
|
||
public function __construct(IntegralDao $dao)
|
||
{
|
||
$this->dao = $dao;
|
||
}
|
||
/**
|
||
* Common: 积分变更
|
||
* Author: wu-hui
|
||
* Time: 2023/11/07 10:45
|
||
* @param int $uid
|
||
* @param int $mer_id
|
||
* @param float $changeNumber
|
||
*/
|
||
public function changeIntegral(int $uid, int $mer_id, float $changeNumber){
|
||
$info = $this->dao->findOrCreate([
|
||
'uid' => $uid,
|
||
'mer_id' => $mer_id
|
||
]);
|
||
$info->number = (float)sprintf("%.2f",$info->number + $changeNumber);
|
||
$info->save();
|
||
}
|
||
|
||
|
||
|
||
|
||
}
|