commit
ea840ca719
@ -75,13 +75,14 @@ class StoreOrderDao extends BaseDao
|
||||
$query->where('is_del', 0);
|
||||
});
|
||||
if (isset($where['source']) && ($where['source'] == 103||$where['source'] == 105)) {
|
||||
$wheres['activity_type'] = [0,98];
|
||||
$wheres['activity_type'] = [0, 2, 98];
|
||||
$wheres['source'] = [0,2,103,105];
|
||||
$query->where($wheres);
|
||||
unset($where['source']);
|
||||
} else {
|
||||
if(isset($where['product_type']) && $where['product_type'] !== ''){
|
||||
$query->where('activity_type', $where['product_type']);
|
||||
$where['product_type'] = [$where['product_type'], 2];
|
||||
$query->whereIn('activity_type', $where['product_type']);
|
||||
}
|
||||
}
|
||||
$query->when(($sysDel !== null), function ($query) use ($sysDel) {
|
||||
|
@ -82,7 +82,7 @@ class StoreOrderCreateRepository extends StoreOrderRepository
|
||||
$allowDelivery = true;
|
||||
$activityProductCount = 0;
|
||||
foreach ($merchantCartList as $merchantCart) {
|
||||
if (($merchantCart['type_id'] != Merchant::TypeSupplyChain) && $address) {
|
||||
if (($merchantCart['type_id'] != Merchant::TypeSupplyChain) && $address && $merchantCart['list'][0]['product_type'] != 2) {
|
||||
if ($merchantCart['street_id'] != $address['street_code'] && $createOrder && !in_array($merchantCart['mer_id'], $takes)) {
|
||||
throw new ValidateException('不支持跨区域购买,请在【我的】-【地址管理】更改后重新购买');
|
||||
}
|
||||
|
@ -576,7 +576,7 @@ class StoreOrderRepository extends BaseRepository
|
||||
}
|
||||
$where['activity_type'] = $product_type;
|
||||
if ($source == 103) {
|
||||
$where['activity_type'] = [0, 98];
|
||||
$where['activity_type'] = [0, 2, 98];
|
||||
$where['source'] = [0, 2, 103,105];
|
||||
}
|
||||
$noComment = $this->dao->search(['uid' => $uid, 'is_user' => $isUser])->where($this->getOrderType(4))->where($where)->where('StoreOrder.is_del', 0)->count();
|
||||
|
@ -1286,9 +1286,9 @@ class ProductRepository extends BaseRepository
|
||||
$attr = $this->detailAttr($res['attr']);
|
||||
$attrValue = (in_array($res['product_type'], [3, 4])) ? $res['oldAttrValue'] : $res['attrValue'];
|
||||
$oldProduct = Product::where('product_id', $res['old_product_id'])->field('product_id,stock')->find();
|
||||
$activityId = CloudProduct::where('product_id', $res['product_id'])->value('activity_id');
|
||||
$storeActivityId = CloudProduct::where('product_id', $res['product_id'])->value('activity_id');
|
||||
$sku = $this->detailAttrValue($attrValue, $userInfo, $productType, $activityId);
|
||||
if ($activityId == 2 && isset($oldProduct['stock'])) {
|
||||
if ($storeActivityId == 2 && isset($oldProduct['stock'])) {
|
||||
$res['stock'] = $oldProduct['stock'];
|
||||
foreach ($sku as &$skuItem) {
|
||||
$skuItem['stock'] = $oldProduct['stock'];
|
||||
|
@ -14,7 +14,11 @@
|
||||
namespace app\controller\api\user;
|
||||
|
||||
|
||||
use app\common\dao\store\order\StoreOrderDao;
|
||||
use app\common\model\store\order\StoreOrderOther;
|
||||
use app\common\model\system\merchant\Merchant;
|
||||
use app\common\repositories\store\IntegralRepository;
|
||||
use app\common\repositories\store\order\PresellOrderRepository;
|
||||
use app\common\repositories\store\service\StoreServiceRepository;
|
||||
use app\common\repositories\system\CacheRepository;
|
||||
use app\common\repositories\user\MemberinterestsRepository;
|
||||
@ -31,6 +35,7 @@ use think\db\exception\DataNotFoundException;
|
||||
use think\db\exception\DbException;
|
||||
use think\db\exception\ModelNotFoundException;
|
||||
use app\controller\api\Common;
|
||||
use app\common\model\user\User as UserModel;
|
||||
|
||||
class User extends BaseController
|
||||
{
|
||||
@ -545,4 +550,39 @@ class User extends BaseController
|
||||
$data=$common->Qrcode(['code'=>$siteUrl.'download/index.html?code=shop_'.$this->user->uid,'id'=>$this->user->uid]);
|
||||
return app('json')->success(['url'=>$data]);
|
||||
}
|
||||
|
||||
/**
|
||||
* 邀请的商户记录
|
||||
* @return mixed
|
||||
* @throws DataNotFoundException
|
||||
* @throws DbException
|
||||
* @throws ModelNotFoundException
|
||||
*/
|
||||
public function merchantRecord()
|
||||
{
|
||||
[$page, $limit] = $this->getPage();
|
||||
$userIds = UserModel::where('spread_uid', $this->user->uid)->column('uid');
|
||||
$query = Merchant::whereIn('uid', $userIds)
|
||||
->where('status', 1)
|
||||
->where('is_del', 0)
|
||||
->where('mer_state', 1);
|
||||
$count = $query->count();
|
||||
$result = $query->page($page, $limit)
|
||||
->field('mer_id,mer_name,uid,real_name')
|
||||
->select()->toArray();
|
||||
$dao = new StoreOrderDao();
|
||||
/** @var PresellOrderRepository $preSellDao */
|
||||
$preSellRepo = app()->make(PresellOrderRepository::class);
|
||||
foreach ($result as &$item) {
|
||||
$saleOrderQuery = $dao->search(['mer_id' => $item['mer_id']])->whereIn('StoreOrder.status', [0, 1, 2, 3, 9, 10])->where('paid', 1);
|
||||
$saleOrderIds = $saleOrderQuery->column('order_id');
|
||||
$saleAmount1 = $saleOrderQuery->sum('StoreOrder.pay_price');
|
||||
$saleAmount2 = $preSellRepo->search(['paid' => 1, 'order_ids' => $saleOrderIds])->sum('pay_price');
|
||||
$item['sale_amount'] = bcadd($saleAmount1, $saleAmount2, 2);
|
||||
$item['buy_amount'] = StoreOrderOther::where('uid', $item['uid'])->whereIn('status', [0, 1, 2, 3, 9, 10])->where('paid', 1)->sum('pay_price');
|
||||
$item['buy_amount'] = bcadd($item['buy_amount'], 0, 2);
|
||||
}
|
||||
return app('json')->success(['count' => $count, 'list' => $result]);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -46,8 +46,9 @@ Route::group('api/', function () {
|
||||
Route::post('articleCatch', 'api.Upload/article');
|
||||
//强制登录
|
||||
Route::group(function () {
|
||||
|
||||
|
||||
Route::any('qrcode', 'api.user.User/qrcode');
|
||||
Route::get('merchantRecord', 'api.user.User/merchantRecord');
|
||||
|
||||
Route::post('merchant_license_identify', 'api.Common/merchant_license_identify');//营业执照识别
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user