优化代码

main
fengxinyhyl 7 months ago
parent e6c1b53888
commit e7de21b464
  1. 4
      app/common/repositories/system/CacheRepository.php
  2. 29
      app/common/repositories/user/UserAssetsLogRepository.php
  3. 6
      app/controller/api/Auth.php
  4. BIN
      public/static/images/1.png
  5. BIN
      public/static/images/2.png
  6. BIN
      public/static/images/3.png
  7. BIN
      public/static/images/prizeBg.png
  8. BIN
      public/static/images/prizeCir.png
  9. BIN
      public/static/images/prizeTitle.png
  10. BIN
      public/static/images/start.png

@ -68,6 +68,8 @@ class CacheRepository extends BaseRepository
const SYS_SVIP = 'sys_svip';
//预存注意事项
const LOTTERY_RULE = 'the_lottery_rule';
//抽奖规则
const LOTTERY_RULE2 = 'the_lottery_rule2';
public function getAgreeList($type)
{
@ -76,6 +78,7 @@ class CacheRepository extends BaseRepository
['label' => '隐私政策', 'key' => self::USER_PRIVACY],
['label' => '平台规则', 'key' => self::PLATFORM_RULE],
['label' => '注销重要提示', 'key' => self::CANCELLATION_PROMPT],
['label' => '抽奖规则', 'key' => self::LOTTERY_RULE2],
['label' => '预存注意事项', 'key' => self::LOTTERY_RULE],
];
if (!$type) {
@ -108,6 +111,7 @@ class CacheRepository extends BaseRepository
self::COUPON_AGREE,
self::SYS_SVIP,
self::LOTTERY_RULE,
self::LOTTERY_RULE2,
];
}

@ -138,11 +138,8 @@ class UserAssetsLogRepository extends BaseRepository
public function userRefundEvent($orderItem)
{
// 更新该订单的所有数据为退款状态
$this->dao->updateOrderStatus($orderItem['order_id'], self::STATUS_REFUND);
$item = $this->dao->getWhere(array('id' => $orderItem));
if($item){
$item = $this->dao->getWhere(array('order_id' => $orderItem['order_id']));
if ($item) {
$item->status = self::STATUS_REFUND;
$item->save();
}
@ -150,17 +147,18 @@ class UserAssetsLogRepository extends BaseRepository
}
public function userPayEvent($groupOrder){
public function userPayEvent($groupOrder)
{
foreach ($groupOrder['orderList'] as $orderItem) {
// 5. 本人使用的福利积分
if ($orderItem['integral']) {
$log = array('uid' => $orderItem['uid'],
'asset_type' => self::ASSET_INTEGRAL,
'type' => self::INTEGRAL_BUY,
'status' => self::STATUS_BUY,
'order_id' => $orderItem['order_id'],
'count' => -$orderItem['integral'],
$log = array('uid' => $orderItem['uid'],
'asset_type' => self::ASSET_INTEGRAL,
'type' => self::INTEGRAL_BUY,
'status' => self::STATUS_BUY,
'order_id' => $orderItem['order_id'],
'count' => -$orderItem['integral'],
);
$this->addLog([$log]);
$this->userAssetsRepository->updateAssets($orderItem['uid'], array('integral_buy' => -$orderItem['integral']));
@ -317,7 +315,7 @@ class UserAssetsLogRepository extends BaseRepository
$orderData = $orderRepository->orderStatisticsByUidArr($uidArr);
foreach ($groupList as $group) {
if ($orderData['count'] >= $group['order_count'] or $orderData['sum'] >= $group['order_sum']) {
if($group['group_id'] > $user['group_id']){
if ($group['group_id'] > $user['group_id']) {
$user['group_id'] = $group['group_id'];
$user->save();
}
@ -373,7 +371,7 @@ class UserAssetsLogRepository extends BaseRepository
}
// 计算每个购买当前爆单商品的积分数据
$profit = $productItem['total_price'] - $productItem['cost']*$productItem['product_num'];
$profit = $productItem['total_price'] - $productItem['cost'] * $productItem['product_num'];
$where = array();
$where[] = array('product_id', '=', $productItem['product_id']);
$list = $hotRepository->getList($where);
@ -574,6 +572,9 @@ class UserAssetsLogRepository extends BaseRepository
if ($item['count'] > 0) {
$item['count'] = "+" . $item['count'];
}
if ($item['status'] == 5) {
$item['type'] .= '(退款)';
}
$user = $userRepository->get($item['uid']);
if ($user) {
$item['user_nickname'] = $user['nickname'];

@ -15,6 +15,7 @@ namespace app\controller\api;
use app\common\repositories\store\DepositRepository;
use app\common\repositories\system\CacheRepository;
use app\common\repositories\user\DepositRecordDailyRepository;
use app\common\repositories\user\LotteryRecordRepository;
use app\common\repositories\store\LotteryRepository;
@ -208,7 +209,10 @@ class Auth extends BaseController
public function lotteryData(){
return app('json')->success(app(LotteryRepository::class)->getList([]));
$lotteryList = app(LotteryRepository::class)->getList([]);
$rule = app(CacheRepository::class)->getResult("the_lottery_rule2");
return app('json')->success(array('list' => $lotteryList, 'rule' => $rule));
}
public function depositData(){

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 27 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 66 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 70 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 34 KiB

Loading…
Cancel
Save