| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576 |
- <?php
- namespace app\admin\logic;
- use app\admin\model\dao\MoneyLog;
- use app\admin\model\dao\ScoreLog;
- use app\admin\model\dao\ShopOrder;
- use app\admin\model\dao\User;
- use app\common\model\ScoreLogModel;
- use think\facade\Cache;
- use think\facade\Db;
- class ScoreLogLogic
- {
- // 1. 报名消费抢购扣除 2.消费券任务发放 3.爆仓 补足前面两个的百分之七十 4.爆仓那个全部返回 5 商城购买商品返积分 6兑换商品,12-平台充补,13-平台扣除
- private static $typeMap = [
- ['id' => 0, 'name' => '其他'],
- ['id' => 1, 'name' => '报名消费抢购扣除'],
- ['id' => 2, 'name' => '消费券任务发放'],
- ['id' => 3, 'name' => '爆仓 补足前面两个的百分之七十'],
- ['id' => 4, 'name' => '爆仓那个全部返回'],
- ['id' => 5, 'name' => '商城购买商品返积分'],
- ['id' => 6, 'name' => '兑换商品'],
- ['id' => 12, 'name' => '平台充补'],
- ['id' => 13, 'name' => '平台扣除'],
- ];
- private static $stateMap = [
- ['id' => 1, 'name' => '增加'],
- ['id' => 2, 'name' => '减少']
- ];
- /**
- * @return array[]
- */
- public static function getStateMap(): array
- {
- return self::$stateMap;
- }
- /**
- * @return array[]
- */
- public static function getTypeMap(): array
- {
- return self::$typeMap;
- }
- public static function scoreLog(mixed $page, mixed $limit, mixed $where, array $sort)
- {
- $model = new ScoreLogModel();
- $count = $model
- ->where($where)
- ->count();
- $type_conf = config('type.score');
- $list = $model
- ->where($where)
- ->withAttr('type', function ($value, $data) use ($type_conf) {
- return $type_conf[$value];
- })
- ->withAttr('score', function ($value, $data) {
- if ($data['state'] == 2)
- $value = '-' . $value;
- return $value;
- })
- ->page($page, $limit)
- ->order($sort)
- ->select();
- return [$count, $list];
- }
- }
|