You've already forked qlg.tsgz.moe
addons
extend
hyhproject
admin
app
common
conf
controller
Alipays.php
Appport.php
Areas.php
Articles.php
Auth.php
Base.php
Brands.php
Carts.php
Cashconfigs.php
Cashdraws.php
Chain3.php
Chain3base.php
Ect.php
Ectwallets.php
Error.php
Favorites.php
Goods.php
Goodsappraises.php
Goodscats.php
Goodsconsult.php
Index.php
Invoices.php
Juhui.php
Logmoneys.php
Messages.php
News.php
Ordercomplains.php
Orderrefunds.php
Orders.php
Position.php
Qlgpay.php
Shoporders.php
Shopping.php
Shops.php
Switchs.php
Tag.php
Tags.php
Tmp.php
Unionpays.php
UserLevel.php
Useraddress.php
Users.php
Userscores.php
Uservouchers.php
Wallets.php
Weixinpays.php
model
validate
common
home
home2
mobile2
wechat2
.htaccess
command.php
mobile
oss
static
thinkphp
upload
vendor
wxtmp
.gitignore
.htaccess
.user.ini
404.html
admin.php
cash.lock
demo.php
get_startup.php
get_version.php
get_version_new.php
index.html
index.php
reg.lock
robots.txt
80 lines
3.7 KiB
PHP
Executable File
80 lines
3.7 KiB
PHP
Executable File
<?php
|
|
namespace wstmart\app\controller;
|
|
use wstmart\app\model\Index as M;
|
|
use wstmart\admin\model\CashDraws as CM;
|
|
/**
|
|
* ============================================================================
|
|
* 默认控制器
|
|
*/
|
|
class Uservouchers extends Base{
|
|
// 前置方法执行列表
|
|
protected $beforeActionList = [
|
|
'checkAuth' => ['except'=>'startgivevouchers,savedaymoney']// 访问这些except下的方法不需要执行前置操作
|
|
];
|
|
/**
|
|
* 保存每日券值
|
|
* @return [type] [description]
|
|
*/
|
|
public function saveDayMoney(){
|
|
$date = date('Y-m-d');
|
|
$m = new CM();
|
|
$m->viewReport($date,1);
|
|
}
|
|
/**
|
|
* 分配券值
|
|
* @return [type] [description]
|
|
*/
|
|
public function startGiveVouchers(){
|
|
Model('UserVouchers')->startGiveVouchers();
|
|
}
|
|
//获取券值
|
|
public function getVouchers(){
|
|
$m = Model('common/Table');
|
|
$vouchersType = (int)input('post.vouchersType');//1产品券2优惠券3旺旺券
|
|
$isExpected = (int)input('post.isExpected');//是否是预获值
|
|
$userId = $this->getUserId();
|
|
$list = [];
|
|
if(1 == $isExpected){
|
|
if(1 == $vouchersType || 2 == $vouchersType){
|
|
$vouchersNames = [1=>'expectedProductNum',2=>'expectedCouponsNum'];
|
|
$m->setTable('user_vouchers_notice');
|
|
$list = $m->getSelect(['userId'=>$userId,$vouchersNames[$vouchersType]=>['>=',0.01],'isShow'=>1],$vouchersNames[$vouchersType].' num,remark,moneyType,createTime','id DESC');
|
|
if(!empty($list['Rows'])){
|
|
foreach ($list['Rows'] as &$v) {
|
|
$v['createTime'] = date('Y-m-d H:i:s',$v['createTime']);
|
|
}
|
|
}
|
|
}else{
|
|
$m->setTable('shops');
|
|
$shopIds = $m->getColumn(['status'=>1,'userId'=>$userId],'shopId');
|
|
// dump($shopIds);
|
|
if($shopIds){
|
|
$m->setTable('orders');
|
|
$list = db('orders')->where(['shopId'=>['in',$shopIds],'orderStatus'=>['BETWEEN','0,1'],'num'=>['>=',0.01],'dataFlag'=>1])->field('SUM((productNum - productHandlingFee - productTaxFee) + (couponsNum - couponsHandlingFee - couponsTaxFee) + wangNum) num ,CONCAT("订单编号:",orderNo,",收入") as remark,dataFlag moneyType,createTime')->group('orderId')->order('orderId DESC')->paginate(input('pageSize/d',10))->toArray();
|
|
}
|
|
}
|
|
}else{
|
|
$m->setTable('shops');
|
|
$shopIds = $m->getColumn(['status'=>1,'userId'=>$userId],'shopId');
|
|
$m->setTable('log_moneys');
|
|
$list = db('log_moneys')->where("((targetType = 0 AND targetId = $userId ) OR (targetType = 1 AND targetId IN ('".implode("','",$shopIds) ."'))) AND moneyName = $vouchersType AND dataFlag=1")->field('money num,remark,moneyType,createTime')->order('id DESC')->paginate(input('pageSize/d',10))->toArray();
|
|
//dump(db()->_sql());
|
|
// $list = $m->getSelect(['targetType'=>0,'targetId'=>$userId,'moneyName'=>$vouchersType,'dataFlag'=>1],'money num,remark,moneyType,createTime','id DESC');
|
|
}
|
|
exit(jsonReturn('',1,$list));
|
|
}
|
|
public function getHelpGet(){
|
|
$m = Model('common/Table');
|
|
$userId = $this->getUserId();
|
|
$list = [];
|
|
$m->setTable('user_help_get_notice');
|
|
$list = $m->getSelect(['userId'=>$userId,'isShow'=>1],'helpGet,remark,isAdd,createTime','id DESC');
|
|
if(!empty($list['Rows'])){
|
|
foreach ($list['Rows'] as &$v) {
|
|
$v['createTime'] = date('Y-m-d H:i:s',$v['createTime']);
|
|
}
|
|
}
|
|
exit(jsonReturn('',1,$list));
|
|
}
|
|
}
|