1748153932 11 months ago
parent 11c5f9df2e
commit 32e564d52f
  1. 27
      app/command/brand.php
  2. 43
      app/common/model/user/UserPre.php
  3. 2
      app/common/repositories/store/product/ProductLabelRepository.php
  4. 17
      app/controller/api/user/User.php
  5. 23
      app/controller/merchant/user/UserMerchant.php
  6. 1
      route/api.php
  7. 6
      route/merchant/users.php

@ -77,7 +77,9 @@ class brand extends Command
//全网品宣贡献值之和 //全网品宣贡献值之和
$allBrandValue = userModel::getDB()->where('status', 1)->sum('brand_integral'); $allBrandValue = userModel::getDB()->where('status', 1)->sum('brand_integral');
if ($allBrandValue <= 0) {
die;
}
Db::startTrans(); Db::startTrans();
foreach ($userList as $k => $v) { foreach ($userList as $k => $v) {
try { try {
@ -94,20 +96,15 @@ class brand extends Command
]); ]);
//用户总贡献值 = 当前总贡献值+昨日的品宣贡献值 //用户总贡献值 = 当前总贡献值+昨日的品宣贡献值
$all_value = $brandGongxian + $v['all_value']; $all_value = $brandGongxian + $v['all_value'];
//贡献值自动转换为超级积分 暂定1:1
// $superBrand = $all_value; $growth_num = bcdiv($all_value, $v['growth_rate'], 2);
//超级积分自动转换为增值积分 按照每天的比例 这个是重点 userModel::getDB()
// $brandAdd = $superBrand; ->where('uid', $v['uid'])
$user = userModel::getDB()->where('uid', $v['uid'])->find(); ->update([
// //品宣积分清0 'brand_integral' => 0,
// $user->brand_integral = 0; 'all_value' => 0,
//总贡献清0 'brokerage_price' => $growth_num
$user->all_value = $all_value; ]);
// //更新增值积分
// $user->brand_add += $brandAdd;
//天数+1
$user->super_days += 1;
$user->save();
Db::commit(); Db::commit();
} catch (\Exception $exception) { } catch (\Exception $exception) {

@ -0,0 +1,43 @@
<?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\model\user;
use app\common\model\BaseModel;
use app\common\repositories\store\CityAreaRepository;
class UserPre extends BaseModel
{
/**
* @return string
* @author xaboy
* @day 2020-03-30
*/
public static function tablePk(): string
{
return 'id';
}
/**
* @return string
* @author xaboy
* @day 2020-03-30
*/
public static function tableName(): string
{
return 'user_pre';
}
}

@ -104,7 +104,7 @@ class ProductLabelRepository extends BaseRepository
if (!is_array($data)) $data = explode(',', $data); if (!is_array($data)) $data = explode(',', $data);
foreach ($data as $item) { foreach ($data as $item) {
$data = $this->dao->getSearch(['product_label_id' => $item,'mer_id' => $merId])->find(); $data = $this->dao->getSearch(['product_label_id' => $item,'mer_id' => $merId])->find();
if (!$data) throw new ValidateException( '标签ID:'.$item.',不存在'); // if (!$data) throw new ValidateException( '标签ID:'.$item.',不存在');
} }
} }
return true; return true;

@ -14,6 +14,7 @@
namespace app\controller\api\user; namespace app\controller\api\user;
use AlibabaCloud\SDK\Dysmsapi\V20170525\Models\AddShortUrlResponseBody\data;
use app\common\repositories\store\IntegralRepository; use app\common\repositories\store\IntegralRepository;
use app\common\repositories\store\service\StoreServiceRepository; use app\common\repositories\store\service\StoreServiceRepository;
use app\common\repositories\system\CacheRepository; use app\common\repositories\system\CacheRepository;
@ -21,6 +22,7 @@ use app\common\repositories\user\MemberinterestsRepository;
use app\common\repositories\user\UserBillRepository; use app\common\repositories\user\UserBillRepository;
use app\common\repositories\user\UserBrokerageRepository; use app\common\repositories\user\UserBrokerageRepository;
use app\common\model\user\ValueContributionLog; use app\common\model\user\ValueContributionLog;
use app\common\model\user\UserPre;
use app\common\model\store\product\Product; use app\common\model\store\product\Product;
use app\common\model\user\CashLog; use app\common\model\user\CashLog;
use app\common\repositories\user\UserRepository; use app\common\repositories\user\UserRepository;
@ -368,6 +370,21 @@ class User extends BaseController
return app('json')->success('分享成功'); return app('json')->success('分享成功');
} }
public function preSuply()
{
$produceid = $this->request->param('id');
$num = $this->request->param('num');
$merid = Product::getDB()->where('product_id', $produceid)->find()->mer_id;
UserPre::getDB()->insert([
'uid' => $this->user->uid,
'num' => $num,
'mer_id' => $merid,
'ctime' => date('Y-m-d H:i:s'),
]);
return app('json')->success('成功');
}
//获取用户积分/贡献值明细变动 //获取用户积分/贡献值明细变动
public function getBrandList() public function getBrandList()
{ {

@ -16,6 +16,8 @@ namespace app\controller\merchant\user;
use app\common\repositories\store\coupon\StoreCouponUserRepository; use app\common\repositories\store\coupon\StoreCouponUserRepository;
use app\common\repositories\store\order\StoreOrderRepository; use app\common\repositories\store\order\StoreOrderRepository;
use app\common\model\user\UserPre;
use app\common\model\user\User as userModel;
use app\common\repositories\user\UserLabelRepository; use app\common\repositories\user\UserLabelRepository;
use app\common\repositories\user\UserMerchantRepository; use app\common\repositories\user\UserMerchantRepository;
use crmeb\basic\BaseController; use crmeb\basic\BaseController;
@ -62,6 +64,27 @@ class UserMerchant extends BaseController
return app('json')->success($this->repository->getList($where, $page, $limit)); return app('json')->success($this->repository->getList($where, $page, $limit));
} }
public function getList2()
{
$list = UserPre::getDB()->where('status', 0)->where('mer_id', $this->request->merId())->select()->toArray();
foreach ($list as &$v) {
$v['nickname'] = userModel::getDB()->where('uid', $v['uid'])->find()->nickname;
}
return app('json')->success($list);
}
public function getList3()
{
$where = $this->request->params(['id', 'status']);
$list = UserPre::getDB()->where('id', $where['id'])->update(['status' => $where['status']]);
return app('json')->success('');
}
/** /**
* @param $id * @param $id

@ -110,6 +110,7 @@ Route::group('api/', function () {
//wmc //wmc
//分享视频/推文增加品宣积分 //分享视频/推文增加品宣积分
Route::get('brand', 'User/brand'); Route::get('brand', 'User/brand');
Route::get('preSuply', 'User/preSuply');
Route::get('getBrandList', 'User/getBrandList'); Route::get('getBrandList', 'User/getBrandList');
Route::get('getPayConfig', 'User/getPayConfig'); Route::get('getPayConfig', 'User/getPayConfig');
Route::get('cashWithdrawal', 'User/cashWithdrawal'); Route::get('cashWithdrawal', 'User/cashWithdrawal');

@ -28,6 +28,12 @@ Route::group(function () {
Route::get('lst', '/getList')->name('merchantUserLst')->option([ Route::get('lst', '/getList')->name('merchantUserLst')->option([
'_alias' => '列表', '_alias' => '列表',
]); ]);
Route::get('lst2', '/getList2')->name('merchantUserLst2')->option([
'_alias' => '列表',
]);
Route::get('lst3', '/getList3')->name('merchantUserLst3')->option([
'_alias' => '列表',
]);
//修改用户标签 //修改用户标签
Route::get('change_label/form/:id', '/changeLabelForm')->name('merchantUserChangeLabelForm')->option([ Route::get('change_label/form/:id', '/changeLabelForm')->name('merchantUserChangeLabelForm')->option([
'_alias' => '修改标签表单', '_alias' => '修改标签表单',

Loading…
Cancel
Save