mirror of
https://github.com/crmeb/CRMEB.git
synced 2026-03-17 19:23:36 +00:00
更新小程序订阅消息
This commit is contained in:
parent
4a8c077752
commit
cc222e0a9e
@ -13,6 +13,7 @@ use app\admin\model\user\User as UserModel;//用户
|
|||||||
use app\admin\model\store\StoreProductReply as StoreProductReplyModel;//评论
|
use app\admin\model\store\StoreProductReply as StoreProductReplyModel;//评论
|
||||||
use app\admin\model\store\StoreProduct as ProductModel;//产品
|
use app\admin\model\store\StoreProduct as ProductModel;//产品
|
||||||
use FormBuilder\Json;
|
use FormBuilder\Json;
|
||||||
|
use think\facade\Config;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 首页控制器
|
* 首页控制器
|
||||||
@ -31,8 +32,9 @@ class Index extends AuthController
|
|||||||
$this->assign([
|
$this->assign([
|
||||||
'menuList' => SystemMenus::menuList(),
|
'menuList' => SystemMenus::menuList(),
|
||||||
'site_logo' => json_decode($site_logo['value'], true),
|
'site_logo' => json_decode($site_logo['value'], true),
|
||||||
'new_order_audio_link'=>sysConfig('new_order_audio_link'),
|
'new_order_audio_link' => sys_config('new_order_audio_link'),
|
||||||
'role_name'=>SystemRole::where('id',$roles[0])->field('role_name')->find()
|
'role_name' => SystemRole::where('id', $roles[0])->field('role_name')->find(),
|
||||||
|
'workermanPort' => Config::get('workerman.admin.port')
|
||||||
]);
|
]);
|
||||||
return $this->fetch();
|
return $this->fetch();
|
||||||
}
|
}
|
||||||
@ -141,7 +143,8 @@ class Index extends AuthController
|
|||||||
/**
|
/**
|
||||||
* 订单图表
|
* 订单图表
|
||||||
*/
|
*/
|
||||||
public function orderchart(){
|
public function orderchart()
|
||||||
|
{
|
||||||
header('Content-type:text/json');
|
header('Content-type:text/json');
|
||||||
$cycle = $this->request->param('cycle') ?: 'thirtyday';//默认30天
|
$cycle = $this->request->param('cycle') ?: 'thirtyday';//默认30天
|
||||||
$datalist = [];
|
$datalist = [];
|
||||||
@ -527,10 +530,12 @@ class Index extends AuthController
|
|||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 用户图表
|
* 用户图表
|
||||||
*/
|
*/
|
||||||
public function userchart(){
|
public function userchart()
|
||||||
|
{
|
||||||
header('Content-type:text/json');
|
header('Content-type:text/json');
|
||||||
|
|
||||||
$starday = date('Y-m-d', strtotime('-30 day'));
|
$starday = date('Y-m-d', strtotime('-30 day'));
|
||||||
|
|||||||
@ -127,13 +127,7 @@ SCRIPT;
|
|||||||
],Url::buildUrl('/user/bill/2')->suffix(false)->build());
|
],Url::buildUrl('/user/bill/2')->suffix(false)->build());
|
||||||
break;
|
break;
|
||||||
case 'routine':
|
case 'routine':
|
||||||
RoutineTemplate::sendOut('ORDER_REFUND_SUCCESS',$UserRecharge['uid'],[
|
RoutineTemplate::sendRechargeSuccess($UserRecharge,$data['refund_price']);
|
||||||
'keyword1'=>$UserRecharge['order_id'],
|
|
||||||
'keyword2'=>date('Y-m-d H:i:s',time()),
|
|
||||||
'keyword3'=>$UserRecharge['price'],
|
|
||||||
'keyword4'=>'余额充值退款',
|
|
||||||
'keyword5'=>'亲,您充值的金额已退款,本次退款'. $data['refund_price'].'金额',
|
|
||||||
]);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
UserBill::expend('系统退款',$UserRecharge['uid'],'now_money','user_recharge_refund',$refund_price,$id,$UserRecharge['price'],'退款给用户'.$refund_price.'元');
|
UserBill::expend('系统退款',$UserRecharge['uid'],'now_money','user_recharge_refund',$refund_price,$id,$UserRecharge['price'],'退款给用户'.$refund_price.'元');
|
||||||
|
|||||||
@ -3,6 +3,7 @@
|
|||||||
namespace app\admin\controller\routine;
|
namespace app\admin\controller\routine;
|
||||||
|
|
||||||
use app\admin\controller\AuthController;
|
use app\admin\controller\AuthController;
|
||||||
|
use crmeb\services\CacheService;
|
||||||
use crmeb\services\FormBuilder as Form;
|
use crmeb\services\FormBuilder as Form;
|
||||||
use crmeb\services\UtilService as Util;
|
use crmeb\services\UtilService as Util;
|
||||||
use crmeb\services\JsonService as Json;
|
use crmeb\services\JsonService as Json;
|
||||||
@ -43,6 +44,7 @@ class RoutineTemplate extends AuthController
|
|||||||
$this->assign(compact('form'));
|
$this->assign(compact('form'));
|
||||||
return $this->fetch('public/form-builder');
|
return $this->fetch('public/form-builder');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function save()
|
public function save()
|
||||||
{
|
{
|
||||||
$data = Util::postMore([
|
$data = Util::postMore([
|
||||||
@ -60,6 +62,7 @@ class RoutineTemplate extends AuthController
|
|||||||
if ($data['content'] == '') return Json::fail('请输入回复内容');
|
if ($data['content'] == '') return Json::fail('请输入回复内容');
|
||||||
$data['add_time'] = time();
|
$data['add_time'] = time();
|
||||||
RoutineTemplateModel::create($data);
|
RoutineTemplateModel::create($data);
|
||||||
|
CacheService::clear();
|
||||||
return Json::successful('添加模板消息成功!');
|
return Json::successful('添加模板消息成功!');
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -94,6 +97,7 @@ class RoutineTemplate extends AuthController
|
|||||||
$product = RoutineTemplateModel::get($id);
|
$product = RoutineTemplateModel::get($id);
|
||||||
if (!$product) return Json::fail('数据不存在!');
|
if (!$product) return Json::fail('数据不存在!');
|
||||||
RoutineTemplateModel::edit($data, $id);
|
RoutineTemplateModel::edit($data, $id);
|
||||||
|
CacheService::clear();
|
||||||
return Json::successful('修改成功!');
|
return Json::successful('修改成功!');
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -107,9 +111,11 @@ class RoutineTemplate extends AuthController
|
|||||||
if (!$id) return Json::fail('数据不存在!');
|
if (!$id) return Json::fail('数据不存在!');
|
||||||
if (!RoutineTemplateModel::del($id))
|
if (!RoutineTemplateModel::del($id))
|
||||||
return Json::fail(RoutineTemplateModel::getErrorInfo('删除失败,请稍候再试!'));
|
return Json::fail(RoutineTemplateModel::getErrorInfo('删除失败,请稍候再试!'));
|
||||||
else
|
else {
|
||||||
|
CacheService::clear();
|
||||||
return Json::successful('删除成功!');
|
return Json::successful('删除成功!');
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -3,6 +3,7 @@
|
|||||||
namespace app\admin\controller\system;
|
namespace app\admin\controller\system;
|
||||||
|
|
||||||
use app\admin\controller\AuthController;
|
use app\admin\controller\AuthController;
|
||||||
|
use crmeb\services\CacheService;
|
||||||
use crmeb\services\JsonService as Json;
|
use crmeb\services\JsonService as Json;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -48,7 +49,7 @@ class Clear extends AuthController
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
CacheService::clear();
|
||||||
return app('json')->successful('数据缓存刷新成功!');
|
return app('json')->successful('数据缓存刷新成功!');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -12,6 +12,8 @@ namespace app\admin\controller\system;
|
|||||||
use app\admin\controller\AuthController;
|
use app\admin\controller\AuthController;
|
||||||
use app\admin\model\store\StoreProduct;
|
use app\admin\model\store\StoreProduct;
|
||||||
use crmeb\services\JsonService as Json;
|
use crmeb\services\JsonService as Json;
|
||||||
|
use crmeb\services\SystemConfigService;
|
||||||
|
use think\facade\Config;
|
||||||
use think\facade\Db;
|
use think\facade\Db;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -22,11 +24,14 @@ use think\facade\Db;
|
|||||||
class SystemclearData extends AuthController
|
class SystemclearData extends AuthController
|
||||||
{
|
{
|
||||||
|
|
||||||
public function index(){
|
public function index()
|
||||||
|
{
|
||||||
return $this->fetch();
|
return $this->fetch();
|
||||||
}
|
}
|
||||||
|
|
||||||
//清除用户数据
|
//清除用户数据
|
||||||
public function userRelevantData(){
|
public function userRelevantData()
|
||||||
|
{
|
||||||
self::clearData('user_recharge', 1);
|
self::clearData('user_recharge', 1);
|
||||||
self::clearData('user_address', 1);
|
self::clearData('user_address', 1);
|
||||||
self::clearData('user_bill', 1);
|
self::clearData('user_bill', 1);
|
||||||
@ -54,8 +59,10 @@ class SystemclearData extends AuthController
|
|||||||
self::clearData('store_product_relation', 1);
|
self::clearData('store_product_relation', 1);
|
||||||
return Json::successful('清除数据成功!');
|
return Json::successful('清除数据成功!');
|
||||||
}
|
}
|
||||||
|
|
||||||
//清除商城数据
|
//清除商城数据
|
||||||
public function storeData(){
|
public function storeData()
|
||||||
|
{
|
||||||
self::clearData('store_coupon', 1);
|
self::clearData('store_coupon', 1);
|
||||||
self::clearData('store_coupon_issue', 1);
|
self::clearData('store_coupon_issue', 1);
|
||||||
self::clearData('store_bargain', 1);
|
self::clearData('store_bargain', 1);
|
||||||
@ -75,13 +82,17 @@ class SystemclearData extends AuthController
|
|||||||
self::clearData('store_visit', 1);
|
self::clearData('store_visit', 1);
|
||||||
return Json::successful('清除数据成功!');
|
return Json::successful('清除数据成功!');
|
||||||
}
|
}
|
||||||
|
|
||||||
//清除产品分类
|
//清除产品分类
|
||||||
public function categoryData(){
|
public function categoryData()
|
||||||
|
{
|
||||||
self::clearData('store_category', 1);
|
self::clearData('store_category', 1);
|
||||||
return Json::successful('清除数据成功!');
|
return Json::successful('清除数据成功!');
|
||||||
}
|
}
|
||||||
|
|
||||||
//清除订单数据
|
//清除订单数据
|
||||||
public function orderData(){
|
public function orderData()
|
||||||
|
{
|
||||||
self::clearData('store_order', 1);
|
self::clearData('store_order', 1);
|
||||||
self::clearData('store_order_cart_info', 1);
|
self::clearData('store_order_cart_info', 1);
|
||||||
self::clearData('store_order_status', 1);
|
self::clearData('store_order_status', 1);
|
||||||
@ -90,8 +101,10 @@ class SystemclearData extends AuthController
|
|||||||
self::clearData('store_order_status', 1);
|
self::clearData('store_order_status', 1);
|
||||||
return Json::successful('清除数据成功!');
|
return Json::successful('清除数据成功!');
|
||||||
}
|
}
|
||||||
|
|
||||||
//清除客服数据
|
//清除客服数据
|
||||||
public function kefuData(){
|
public function kefuData()
|
||||||
|
{
|
||||||
self::clearData('store_service', 1);
|
self::clearData('store_service', 1);
|
||||||
$this->delDirAndFile('./public/uploads/store/service');
|
$this->delDirAndFile('./public/uploads/store/service');
|
||||||
self::clearData('store_service_log', 1);
|
self::clearData('store_service_log', 1);
|
||||||
@ -99,35 +112,44 @@ class SystemclearData extends AuthController
|
|||||||
}
|
}
|
||||||
|
|
||||||
//清除微信管理数据
|
//清除微信管理数据
|
||||||
public function wechatData(){
|
public function wechatData()
|
||||||
|
{
|
||||||
self::clearData('wechat_media', 1);
|
self::clearData('wechat_media', 1);
|
||||||
self::clearData('wechat_reply', 1);
|
self::clearData('wechat_reply', 1);
|
||||||
self::clearData('cache', 1);
|
self::clearData('cache', 1);
|
||||||
$this->delDirAndFile('./public/uploads/wechat');
|
$this->delDirAndFile('./public/uploads/wechat');
|
||||||
return Json::successful('清除数据成功!');
|
return Json::successful('清除数据成功!');
|
||||||
}
|
}
|
||||||
|
|
||||||
//清除所有附件
|
//清除所有附件
|
||||||
public function uploadData(){
|
public function uploadData()
|
||||||
|
{
|
||||||
self::clearData('system_attachment', 1);
|
self::clearData('system_attachment', 1);
|
||||||
self::clearData('system_attachment_category', 1);
|
self::clearData('system_attachment_category', 1);
|
||||||
$this->delDirAndFile('./public/uploads/');
|
$this->delDirAndFile('./public/uploads/');
|
||||||
return Json::successful('清除上传文件成功!');
|
return Json::successful('清除上传文件成功!');
|
||||||
}
|
}
|
||||||
|
|
||||||
//清除微信用户
|
//清除微信用户
|
||||||
public function wechatuserData(){
|
public function wechatuserData()
|
||||||
|
{
|
||||||
self::clearData('wechat_user', 1);
|
self::clearData('wechat_user', 1);
|
||||||
self::clearData('user', 1);
|
self::clearData('user', 1);
|
||||||
return Json::successful('清除数据成功!');
|
return Json::successful('清除数据成功!');
|
||||||
}
|
}
|
||||||
|
|
||||||
//清除内容分类
|
//清除内容分类
|
||||||
public function articledata(){
|
public function articledata()
|
||||||
|
{
|
||||||
self::clearData('article_category', 1);
|
self::clearData('article_category', 1);
|
||||||
self::clearData('article', 1);
|
self::clearData('article', 1);
|
||||||
self::clearData('article_content', 1);
|
self::clearData('article_content', 1);
|
||||||
return Json::successful('清除数据成功!');
|
return Json::successful('清除数据成功!');
|
||||||
}
|
}
|
||||||
|
|
||||||
//清除系统记录
|
//清除系统记录
|
||||||
public function systemdata(){
|
public function systemdata()
|
||||||
|
{
|
||||||
self::clearData('system_notice_admin', 1);
|
self::clearData('system_notice_admin', 1);
|
||||||
self::clearData('system_log', 1);
|
self::clearData('system_log', 1);
|
||||||
return Json::successful('清除数据成功!');
|
return Json::successful('清除数据成功!');
|
||||||
@ -142,16 +164,66 @@ class SystemclearData extends AuthController
|
|||||||
{
|
{
|
||||||
switch ((int)$type) {
|
switch ((int)$type) {
|
||||||
case 1:
|
case 1:
|
||||||
|
$fileImage = \app\admin\model\system\SystemAttachment::where('module_type', 2)->field(['att_dir', 'satt_dir'])->select();
|
||||||
|
foreach ($fileImage as $image) {
|
||||||
|
if ($image['att_dir'] && ($imagePath = strstr($image['att_dir'], 'uploads')) !== false) {
|
||||||
|
if (is_file($imagePath))
|
||||||
|
unlink($imagePath);
|
||||||
|
unset($imagePath);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($image['satt_dir'] && ($imagePath = strstr($image['satt_dir'], 'uploads')) !== false) {
|
||||||
|
if (is_file($imagePath))
|
||||||
|
unlink($imagePath);
|
||||||
|
unset($imagePath);
|
||||||
|
}
|
||||||
|
}
|
||||||
\app\admin\model\system\SystemAttachment::where('module_type', 2)->delete();
|
\app\admin\model\system\SystemAttachment::where('module_type', 2)->delete();
|
||||||
|
@unlink('uploads/follow/follow.jpg');//删除海报二维码
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
StoreProduct::where('is_del', 1)->delete();
|
StoreProduct::where('is_del', 1)->delete();
|
||||||
break;
|
break;
|
||||||
|
case 3:
|
||||||
|
$value = $this->request->param('value');
|
||||||
|
if (!$value)
|
||||||
|
return Json::fail('请输入需要更换的域名');
|
||||||
|
if (!verify_domain($value))
|
||||||
|
return Json::fail('域名不合法');
|
||||||
|
$siteUrl = SystemConfigService::get('site_url', true);
|
||||||
|
$siteUrlJosn = str_replace('http://', 'http:\\/\\/', $siteUrl);
|
||||||
|
$valueJosn = str_replace('http://', 'http:\\/\\/', $value);
|
||||||
|
$prefix = Config::get('database.connections.' . Config::get('database.default') . '.prefix');
|
||||||
|
$sql = [
|
||||||
|
"UPDATE `{$prefix}system_attachment` SET `att_dir` = replace(att_dir ,'{$siteUrl}','{$value}'),`satt_dir` = replace(satt_dir ,'{$siteUrl}','{$value}')",
|
||||||
|
"UPDATE `{$prefix}store_product` SET `image` = replace(image ,'{$siteUrl}','{$value}'),`slider_image` = replace(slider_image ,'{$siteUrl}','{$value}'),`description`= replace(description,'{$siteUrl}','{$value}')",
|
||||||
|
"UPDATE `{$prefix}store_product_attr_value` SET `image` = replace(image ,'{$siteUrl}','{$value}')",
|
||||||
|
"UPDATE `{$prefix}store_seckill` SET `image` = replace(image ,'{$siteUrl}','{$value}'),`images` = replace(images,'{$siteUrl}','{$value}'),`description` = replace(description,'{$siteUrl}','{$value}')",
|
||||||
|
"UPDATE `{$prefix}store_combination` SET `image` = replace(image ,'{$siteUrl}','{$value}'),`images` = replace(images,'{$siteUrl}','{$value}'),`description` = replace(description,'{$siteUrl}','{$value}')",
|
||||||
|
"UPDATE `{$prefix}store_bargain` SET `image` = replace(image ,'{$siteUrl}','{$value}'),`images` = replace(images,'{$siteUrl}','{$value}'),`description` = replace(description,'{$siteUrl}','{$value}')",
|
||||||
|
"UPDATE `{$prefix}system_config` SET `value` = replace(value ,'{$siteUrlJosn}','{$valueJosn}')",
|
||||||
|
"UPDATE `{$prefix}article_category` SET `image` = replace(`image` ,'{$siteUrl}','{$value}')",
|
||||||
|
"UPDATE `{$prefix}article` SET `image_input` = replace(`image_input` ,'{$siteUrl}','{$value}')",
|
||||||
|
"UPDATE `{$prefix}article_content` SET `content` = replace(`content` ,'{$siteUrl}','{$value}')",
|
||||||
|
"UPDATE `{$prefix}store_category` SET `pic` = replace(`pic` ,'{$siteUrl}','{$value}')",
|
||||||
|
"UPDATE `{$prefix}system_group_data` SET `value` = replace(value ,'{$siteUrlJosn}','{$valueJosn}')"
|
||||||
|
];
|
||||||
|
try {
|
||||||
|
foreach ($sql as $item) {
|
||||||
|
db::execute($item);
|
||||||
|
}
|
||||||
|
} catch (\Throwable $e) {
|
||||||
|
return Json::fail('替换失败,失败原因:' . $e->getMessage());
|
||||||
|
}
|
||||||
|
return Json::success('替换成功!');
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
return Json::successful('清除数据成功!');
|
return Json::successful('清除数据成功!');
|
||||||
}
|
}
|
||||||
|
|
||||||
//清除制定表数据
|
//清除制定表数据
|
||||||
public function clearData($table_name,$status){
|
public function clearData($table_name, $status)
|
||||||
|
{
|
||||||
$table_name = config('database.connections.' . config('database.default'))['prefix'] . $table_name;
|
$table_name = config('database.connections.' . config('database.default'))['prefix'] . $table_name;
|
||||||
if ($status) {
|
if ($status) {
|
||||||
@db::execute('TRUNCATE TABLE ' . $table_name);
|
@db::execute('TRUNCATE TABLE ' . $table_name);
|
||||||
@ -160,8 +232,10 @@ class SystemclearData extends AuthController
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//递归删除文件
|
//递归删除文件
|
||||||
function delDirAndFile($dirName,$subdir=true){
|
function delDirAndFile($dirName, $subdir = true)
|
||||||
|
{
|
||||||
if ($handle = @opendir("$dirName")) {
|
if ($handle = @opendir("$dirName")) {
|
||||||
while (false !== ($item = readdir($handle))) {
|
while (false !== ($item = readdir($handle))) {
|
||||||
if ($item != "." && $item != "..") {
|
if ($item != "." && $item != "..") {
|
||||||
|
|||||||
@ -4,6 +4,7 @@
|
|||||||
* @author: xaboy<365615158@qq.com>
|
* @author: xaboy<365615158@qq.com>
|
||||||
* @day: 2017/11/11
|
* @day: 2017/11/11
|
||||||
*/
|
*/
|
||||||
|
|
||||||
namespace app\admin\controller\user;
|
namespace app\admin\controller\user;
|
||||||
|
|
||||||
use app\admin\controller\AuthController;
|
use app\admin\controller\AuthController;
|
||||||
@ -33,12 +34,14 @@ use app\admin\model\store\StoreCouponUser;
|
|||||||
class User extends AuthController
|
class User extends AuthController
|
||||||
{
|
{
|
||||||
use CurdControllerTrait;
|
use CurdControllerTrait;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 显示资源列表
|
* 显示资源列表
|
||||||
*
|
*
|
||||||
* @return \think\Response
|
* @return \think\Response
|
||||||
*/
|
*/
|
||||||
public function index(){
|
public function index()
|
||||||
|
{
|
||||||
$this->assign('count_user', UserModel::getcount());
|
$this->assign('count_user', UserModel::getcount());
|
||||||
return $this->fetch();
|
return $this->fetch();
|
||||||
}
|
}
|
||||||
@ -211,6 +214,7 @@ class User extends AuthController
|
|||||||
return JsonService::fail('赠送失败');
|
return JsonService::fail('赠送失败');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* 清除会员等级
|
* 清除会员等级
|
||||||
* @param int $uid
|
* @param int $uid
|
||||||
@ -224,12 +228,14 @@ class User extends AuthController
|
|||||||
else
|
else
|
||||||
return JsonService::fail('清除失败');
|
return JsonService::fail('清除失败');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 修改user表状态
|
* 修改user表状态
|
||||||
*
|
*
|
||||||
* @return json
|
* @return json
|
||||||
*/
|
*/
|
||||||
public function set_status($status='',$uid=0,$is_echo=0){
|
public function set_status($status = '', $uid = 0, $is_echo = 0)
|
||||||
|
{
|
||||||
if ($is_echo == 0) {
|
if ($is_echo == 0) {
|
||||||
if ($status == '' || $uid == 0) return Json::fail('参数错误');
|
if ($status == '' || $uid == 0) return Json::fail('参数错误');
|
||||||
UserModel::where(['uid' => $uid])->update(['status' => $status]);
|
UserModel::where(['uid' => $uid])->update(['status' => $status]);
|
||||||
@ -241,12 +247,14 @@ class User extends AuthController
|
|||||||
}
|
}
|
||||||
return Json::successful($status == 0 ? '禁用成功' : '解禁成功');
|
return Json::successful($status == 0 ? '禁用成功' : '解禁成功');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取user表
|
* 获取user表
|
||||||
*
|
*
|
||||||
* @return json
|
* @return json
|
||||||
*/
|
*/
|
||||||
public function get_user_list(){
|
public function get_user_list()
|
||||||
|
{
|
||||||
$where = Util::getMore([
|
$where = Util::getMore([
|
||||||
['page', 1],
|
['page', 1],
|
||||||
['limit', 20],
|
['limit', 20],
|
||||||
@ -266,6 +274,7 @@ class User extends AuthController
|
|||||||
]);
|
]);
|
||||||
return Json::successlayui(UserModel::getUserList($where));
|
return Json::successlayui(UserModel::getUserList($where));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 编辑模板消息
|
* 编辑模板消息
|
||||||
* @param $id
|
* @param $id
|
||||||
@ -370,11 +379,13 @@ class User extends AuthController
|
|||||||
if ($res) return Json::successful('修改成功!');
|
if ($res) return Json::successful('修改成功!');
|
||||||
else return Json::fail('修改失败');
|
else return Json::fail('修改失败');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 用户图表
|
* 用户图表
|
||||||
* @return mixed
|
* @return mixed
|
||||||
*/
|
*/
|
||||||
public function user_analysis(){
|
public function user_analysis()
|
||||||
|
{
|
||||||
$where = Util::getMore([
|
$where = Util::getMore([
|
||||||
['nickname', ''],
|
['nickname', ''],
|
||||||
['status', ''],
|
['status', ''],
|
||||||
@ -471,10 +482,15 @@ class User extends AuthController
|
|||||||
$this->assign(compact('header', 'user_index', 'view', 'user_null', 'consume', 'form', 'grouping', 'where'));
|
$this->assign(compact('header', 'user_index', 'view', 'user_null', 'consume', 'form', 'grouping', 'where'));
|
||||||
return $this->fetch();
|
return $this->fetch();
|
||||||
}
|
}
|
||||||
public function gethreaderValue($chart,$where=[]){
|
|
||||||
|
public function gethreaderValue($chart, $where = [])
|
||||||
|
{
|
||||||
if ($where) {
|
if ($where) {
|
||||||
switch ($where['date']) {
|
switch ($where['date']) {
|
||||||
case null:case 'today':case 'week':case 'year':
|
case null:
|
||||||
|
case 'today':
|
||||||
|
case 'week':
|
||||||
|
case 'year':
|
||||||
if ($where['date'] == null) {
|
if ($where['date'] == null) {
|
||||||
$where['date'] = 'month';
|
$where['date'] = 'month';
|
||||||
}
|
}
|
||||||
@ -508,7 +524,9 @@ class User extends AuthController
|
|||||||
return $chart;
|
return $chart;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public function get_user_index($where,$name){
|
|
||||||
|
public function get_user_index($where, $name)
|
||||||
|
{
|
||||||
switch ($where['date']) {
|
switch ($where['date']) {
|
||||||
case null:
|
case null:
|
||||||
$days = date("t", strtotime(date('Y-m', time())));
|
$days = date("t", strtotime(date('Y-m', time())));
|
||||||
@ -649,7 +667,9 @@ class User extends AuthController
|
|||||||
return ['time' => $times_list, 'series' => $series];
|
return ['time' => $times_list, 'series' => $series];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public function gettime($time='',$season=''){
|
|
||||||
|
public function gettime($time = '', $season = '')
|
||||||
|
{
|
||||||
if (!empty($time) && empty($season)) {
|
if (!empty($time) && empty($season)) {
|
||||||
$timestamp0 = strtotime($time);
|
$timestamp0 = strtotime($time);
|
||||||
$timestamp24 = strtotime($time) + 86400;
|
$timestamp24 = strtotime($time) + 86400;
|
||||||
@ -664,13 +684,16 @@ class User extends AuthController
|
|||||||
/**
|
/**
|
||||||
* 会员等级首页
|
* 会员等级首页
|
||||||
*/
|
*/
|
||||||
public function group(){
|
public function group()
|
||||||
|
{
|
||||||
return $this->fetch();
|
return $this->fetch();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 会员详情
|
* 会员详情
|
||||||
*/
|
*/
|
||||||
public function see($uid=''){
|
public function see($uid = '')
|
||||||
|
{
|
||||||
$this->assign([
|
$this->assign([
|
||||||
'uid' => $uid,
|
'uid' => $uid,
|
||||||
'userinfo' => UserModel::getUserDetailed($uid),
|
'userinfo' => UserModel::getUserDetailed($uid),
|
||||||
@ -680,40 +703,52 @@ class User extends AuthController
|
|||||||
]);
|
]);
|
||||||
return $this->fetch();
|
return $this->fetch();
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* 获取某个用户的推广下线
|
* 获取某个用户的推广下线
|
||||||
* */
|
* */
|
||||||
public function getSpreadList($uid,$page=1,$limit=20){
|
public function getSpreadList($uid, $page = 1, $limit = 20)
|
||||||
|
{
|
||||||
return Json::successful(UserModel::getSpreadList($uid, (int)$page, (int)$limit));
|
return Json::successful(UserModel::getSpreadList($uid, (int)$page, (int)$limit));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取某用户的订单列表
|
* 获取某用户的订单列表
|
||||||
*/
|
*/
|
||||||
public function getOneorderList($uid,$page=1,$limit=20){
|
public function getOneorderList($uid, $page = 1, $limit = 20)
|
||||||
|
{
|
||||||
return Json::successful(StoreOrder::getOneorderList(compact('uid', 'page', 'limit')));
|
return Json::successful(StoreOrder::getOneorderList(compact('uid', 'page', 'limit')));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取某用户的积分列表
|
* 获取某用户的积分列表
|
||||||
*/
|
*/
|
||||||
public function getOneIntegralList($uid,$page=1,$limit=20){
|
public function getOneIntegralList($uid, $page = 1, $limit = 20)
|
||||||
|
{
|
||||||
return Json::successful(UserBillAdmin::getOneIntegralList(compact('uid', 'page', 'limit')));
|
return Json::successful(UserBillAdmin::getOneIntegralList(compact('uid', 'page', 'limit')));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取某用户的积分列表
|
* 获取某用户的积分列表
|
||||||
*/
|
*/
|
||||||
public function getOneSignList($uid,$page=1,$limit=20){
|
public function getOneSignList($uid, $page = 1, $limit = 20)
|
||||||
|
{
|
||||||
return Json::successful(UserBillAdmin::getOneSignList(compact('uid', 'page', 'limit')));
|
return Json::successful(UserBillAdmin::getOneSignList(compact('uid', 'page', 'limit')));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取某用户的持有优惠劵
|
* 获取某用户的持有优惠劵
|
||||||
*/
|
*/
|
||||||
public function getOneCouponsList($uid,$page=1,$limit=20){
|
public function getOneCouponsList($uid, $page = 1, $limit = 20)
|
||||||
|
{
|
||||||
return Json::successful(StoreCouponUser::getOneCouponsList(compact('uid', 'page', 'limit')));
|
return Json::successful(StoreCouponUser::getOneCouponsList(compact('uid', 'page', 'limit')));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取某用户的余额变动记录
|
* 获取某用户的余额变动记录
|
||||||
*/
|
*/
|
||||||
public function getOneBalanceChangList($uid,$page=1,$limit=20){
|
public function getOneBalanceChangList($uid, $page = 1, $limit = 20)
|
||||||
|
{
|
||||||
return Json::successful(UserBillAdmin::getOneBalanceChangList(compact('uid', 'page', 'limit')));
|
return Json::successful(UserBillAdmin::getOneBalanceChangList(compact('uid', 'page', 'limit')));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -67,11 +67,13 @@ class User extends BaseModel
|
|||||||
$num = (float)bcsub($brokerage, $extractTotalPrice, 2);
|
$num = (float)bcsub($brokerage, $extractTotalPrice, 2);
|
||||||
return $num > 0 ? $num : 0;//可提现
|
return $num > 0 ? $num : 0;//可提现
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param $where
|
* @param $where
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
public static function systemPage($where){
|
public static function systemPage($where)
|
||||||
|
{
|
||||||
$model = new self;
|
$model = new self;
|
||||||
if ($where['status'] != '') $model = $model->where('status', $where['status']);
|
if ($where['status'] != '') $model = $model->where('status', $where['status']);
|
||||||
if ($where['is_promoter'] != '') $model = $model->where('is_promoter', $where['is_promoter']);
|
if ($where['is_promoter'] != '') $model = $model->where('is_promoter', $where['is_promoter']);
|
||||||
@ -86,6 +88,7 @@ class User extends BaseModel
|
|||||||
}
|
}
|
||||||
}, $where);
|
}, $where);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* 设置搜索条件
|
* 设置搜索条件
|
||||||
*
|
*
|
||||||
@ -127,12 +130,14 @@ class User extends BaseModel
|
|||||||
}
|
}
|
||||||
return $model;
|
return $model;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 异步获取当前用户 信息
|
* 异步获取当前用户 信息
|
||||||
* @param $where
|
* @param $where
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
public static function getUserList($where){
|
public static function getUserList($where)
|
||||||
|
{
|
||||||
$model = self::setWherePage(self::setWhere($where), $where, ['w.sex', 'w.province', 'w.city', 'u.status', 'u.is_promoter'], ['u.nickname', 'u.uid', 'u.phone']);
|
$model = self::setWherePage(self::setWhere($where), $where, ['w.sex', 'w.province', 'w.city', 'u.status', 'u.is_promoter'], ['u.nickname', 'u.uid', 'u.phone']);
|
||||||
$list = $model->alias('u')
|
$list = $model->alias('u')
|
||||||
->join('WechatUser w', 'u.uid=w.uid')
|
->join('WechatUser w', 'u.uid=w.uid')
|
||||||
@ -174,13 +179,15 @@ class User extends BaseModel
|
|||||||
$count = self::setWherePage(self::setWhere($where), $where, ['w.sex', 'w.province', 'w.city', 'u.status', 'u.is_promoter'], ['u.nickname', 'u.uid'])->alias('u')->join('WechatUser w', 'u.uid=w.uid')->count();
|
$count = self::setWherePage(self::setWhere($where), $where, ['w.sex', 'w.province', 'w.city', 'u.status', 'u.is_promoter'], ['u.nickname', 'u.uid'])->alias('u')->join('WechatUser w', 'u.uid=w.uid')->count();
|
||||||
return ['count' => $count, 'data' => $list];
|
return ['count' => $count, 'data' => $list];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 修改用户状态
|
* 修改用户状态
|
||||||
* @param $uids 用户uid
|
* @param $uids 用户uid
|
||||||
* @param $status 修改状态
|
* @param $status 修改状态
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
public static function destrSyatus($uids,$status){
|
public static function destrSyatus($uids, $status)
|
||||||
|
{
|
||||||
if (empty($uids) && !is_array($uids)) return false;
|
if (empty($uids) && !is_array($uids)) return false;
|
||||||
if ($status == '') return false;
|
if ($status == '') return false;
|
||||||
self::beginTrans();
|
self::beginTrans();
|
||||||
@ -193,13 +200,15 @@ class User extends BaseModel
|
|||||||
return Json::fail($e->getMessage());
|
return Json::fail($e->getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* 获取某季度,某年某年后的时间戳
|
* 获取某季度,某年某年后的时间戳
|
||||||
*
|
*
|
||||||
* self::getMonth('n',1) 获取当前季度的上个季度的时间戳
|
* self::getMonth('n',1) 获取当前季度的上个季度的时间戳
|
||||||
* self::getMonth('n') 获取当前季度的时间戳
|
* self::getMonth('n') 获取当前季度的时间戳
|
||||||
*/
|
*/
|
||||||
public static function getMonth($time='',$ceil=0){
|
public static function getMonth($time = '', $ceil = 0)
|
||||||
|
{
|
||||||
if (empty($time)) {
|
if (empty($time)) {
|
||||||
$firstday = date("Y-m-01", time());
|
$firstday = date("Y-m-01", time());
|
||||||
$lastday = date("Y-m-d", strtotime("$firstday +1 month -1 day"));
|
$lastday = date("Y-m-d", strtotime("$firstday +1 month -1 day"));
|
||||||
@ -219,22 +228,29 @@ class User extends BaseModel
|
|||||||
}
|
}
|
||||||
return array($firstday, $lastday);
|
return array($firstday, $lastday);
|
||||||
}
|
}
|
||||||
public static function getcount(){
|
|
||||||
|
public static function getcount()
|
||||||
|
{
|
||||||
return self::count();
|
return self::count();
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
*获取用户某个时间段的消费信息
|
*获取用户某个时间段的消费信息
|
||||||
*
|
*
|
||||||
* reutrn Array || number
|
* reutrn Array || number
|
||||||
*/
|
*/
|
||||||
public static function consume($where,$status='',$keep=''){
|
public static function consume($where, $status = '', $keep = '')
|
||||||
|
{
|
||||||
$model = new self;
|
$model = new self;
|
||||||
$user_id = [];
|
$user_id = [];
|
||||||
if (is_array($where)) {
|
if (is_array($where)) {
|
||||||
if ($where['is_promoter'] != '') $model = $model->where('is_promoter', $where['is_promoter']);
|
if ($where['is_promoter'] != '') $model = $model->where('is_promoter', $where['is_promoter']);
|
||||||
if ($where['status'] != '') $model = $model->where('status', $where['status']);
|
if ($where['status'] != '') $model = $model->where('status', $where['status']);
|
||||||
switch ($where['date']) {
|
switch ($where['date']) {
|
||||||
case null:case 'today':case 'week':case 'year':
|
case null:
|
||||||
|
case 'today':
|
||||||
|
case 'week':
|
||||||
|
case 'year':
|
||||||
if ($where['date'] == null) {
|
if ($where['date'] == null) {
|
||||||
$where['date'] = 'month';
|
$where['date'] = 'month';
|
||||||
}
|
}
|
||||||
@ -321,16 +337,21 @@ class User extends BaseModel
|
|||||||
return $number;
|
return $number;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* 获取 用户某个时间段的钱数或者TOP20排行
|
* 获取 用户某个时间段的钱数或者TOP20排行
|
||||||
*
|
*
|
||||||
* return Array || number
|
* return Array || number
|
||||||
*/
|
*/
|
||||||
public static function getUserSpend($date,$status=''){
|
public static function getUserSpend($date, $status = '')
|
||||||
|
{
|
||||||
$model = new self();
|
$model = new self();
|
||||||
$model = $model->alias('A');
|
$model = $model->alias('A');
|
||||||
switch ($date) {
|
switch ($date) {
|
||||||
case null:case 'today':case 'week':case 'year':
|
case null:
|
||||||
|
case 'today':
|
||||||
|
case 'week':
|
||||||
|
case 'year':
|
||||||
if ($date == null) $date = 'month';
|
if ($date == null) $date = 'month';
|
||||||
$model = $model->whereTime('A.add_time', $date);
|
$model = $model->whereTime('A.add_time', $date);
|
||||||
break;
|
break;
|
||||||
@ -361,16 +382,21 @@ class User extends BaseModel
|
|||||||
}
|
}
|
||||||
return $list;
|
return $list;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* 获取 相对于上月或者其他的数据
|
* 获取 相对于上月或者其他的数据
|
||||||
*
|
*
|
||||||
* return Array
|
* return Array
|
||||||
*/
|
*/
|
||||||
public static function getPostNumber($date,$status=false,$field='A.add_time',$t='消费'){
|
public static function getPostNumber($date, $status = false, $field = 'A.add_time', $t = '消费')
|
||||||
|
{
|
||||||
$model = new self();
|
$model = new self();
|
||||||
if (!$status) $model = $model->alias('A');
|
if (!$status) $model = $model->alias('A');
|
||||||
switch ($date) {
|
switch ($date) {
|
||||||
case null:case 'today':case 'week':case 'year':
|
case null:
|
||||||
|
case 'today':
|
||||||
|
case 'week':
|
||||||
|
case 'year':
|
||||||
if ($date == null) {
|
if ($date == null) {
|
||||||
$date = 'last month';
|
$date = 'last month';
|
||||||
$title = '相比上月用户' . $t . '增长';
|
$title = '相比上月用户' . $t . '增长';
|
||||||
@ -409,11 +435,13 @@ class User extends BaseModel
|
|||||||
$number = $model->join('user_bill B', 'B.uid=A.uid')->where('B.type', 'pay_product')->where('B.pm', 0)->sum('B.number');
|
$number = $model->join('user_bill B', 'B.uid=A.uid')->where('B.type', 'pay_product')->where('B.pm', 0)->sum('B.number');
|
||||||
return [$number, $title];
|
return [$number, $title];
|
||||||
}
|
}
|
||||||
|
|
||||||
//获取用户新增,头部信息
|
//获取用户新增,头部信息
|
||||||
public static function getBadgeList($where){
|
public static function getBadgeList($where)
|
||||||
|
{
|
||||||
$user_count = self::setWherePage(self::getModelTime($where, new self), $where, ['is_promoter', 'status'])->count();
|
$user_count = self::setWherePage(self::getModelTime($where, new self), $where, ['is_promoter', 'status'])->count();
|
||||||
$user_count_old = self::getOldDate($where)->count();
|
$user_count_old = self::getOldDate($where)->count();
|
||||||
$store_brokerage_statu = sysConfig('store_brokerage_statu');
|
$store_brokerage_statu = sys_config('store_brokerage_statu');
|
||||||
if ($store_brokerage_statu == 1)
|
if ($store_brokerage_statu == 1)
|
||||||
$fenxiao = self::setWherePage(self::getModelTime($where, new self), $where, ['is_promoter', 'status'])->where('spread_uid', '<>', 0)->count();
|
$fenxiao = self::setWherePage(self::getModelTime($where, new self), $where, ['is_promoter', 'status'])->where('spread_uid', '<>', 0)->count();
|
||||||
else
|
else
|
||||||
@ -460,12 +488,14 @@ class User extends BaseModel
|
|||||||
],
|
],
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* 获取会员增长曲线图和分布图
|
* 获取会员增长曲线图和分布图
|
||||||
* $where 查询条件
|
* $where 查询条件
|
||||||
* $limit 显示条数,是否有滚动条
|
* $limit 显示条数,是否有滚动条
|
||||||
*/
|
*/
|
||||||
public static function getUserChartList($where,$limit=20){
|
public static function getUserChartList($where, $limit = 20)
|
||||||
|
{
|
||||||
$list = self::setWherePage(self::getModelTime($where, new self), $where, ['is_promoter', 'status'])
|
$list = self::setWherePage(self::getModelTime($where, new self), $where, ['is_promoter', 'status'])
|
||||||
->where('add_time', '<>', 0)
|
->where('add_time', '<>', 0)
|
||||||
->field('FROM_UNIXTIME(add_time,"%Y-%m-%d") as _add_time,count(uid) as num')
|
->field('FROM_UNIXTIME(add_time,"%Y-%m-%d") as _add_time,count(uid) as num')
|
||||||
@ -505,8 +535,10 @@ class User extends BaseModel
|
|||||||
];
|
];
|
||||||
return compact('shop_data', 'shop_xdata', 'seriesdata', 'Zoom');
|
return compact('shop_data', 'shop_xdata', 'seriesdata', 'Zoom');
|
||||||
}
|
}
|
||||||
|
|
||||||
//获取$date的前一天或者其他的时间段
|
//获取$date的前一天或者其他的时间段
|
||||||
public static function getOldDate($where,$moedls=null){
|
public static function getOldDate($where, $moedls = null)
|
||||||
|
{
|
||||||
$model = $moedls === null ? self::setWherePage(new self(), $where, ['is_promoter', 'status']) : $moedls;
|
$model = $moedls === null ? self::setWherePage(new self(), $where, ['is_promoter', 'status']) : $moedls;
|
||||||
switch ($where['data']) {
|
switch ($where['data']) {
|
||||||
case 'today':
|
case 'today':
|
||||||
@ -528,8 +560,10 @@ class User extends BaseModel
|
|||||||
}
|
}
|
||||||
return $model;
|
return $model;
|
||||||
}
|
}
|
||||||
|
|
||||||
//获取用户属性和性别分布图
|
//获取用户属性和性别分布图
|
||||||
public static function getEchartsData($where){
|
public static function getEchartsData($where)
|
||||||
|
{
|
||||||
$model = self::alias('a');
|
$model = self::alias('a');
|
||||||
$data = self::getModelTime($where, $model, 'a.add_time')
|
$data = self::getModelTime($where, $model, 'a.add_time')
|
||||||
->join('wechat_user r', 'r.uid=a.uid')
|
->join('wechat_user r', 'r.uid=a.uid')
|
||||||
@ -572,8 +606,10 @@ class User extends BaseModel
|
|||||||
}
|
}
|
||||||
return compact('sexList', 'sexlegdata', 'legdata', 'dataList');
|
return compact('sexList', 'sexlegdata', 'legdata', 'dataList');
|
||||||
}
|
}
|
||||||
|
|
||||||
//获取佣金记录列表
|
//获取佣金记录列表
|
||||||
public static function getCommissionList($where){
|
public static function getCommissionList($where)
|
||||||
|
{
|
||||||
$model = self::setCommissionWhere($where);
|
$model = self::setCommissionWhere($where);
|
||||||
if ($where['excel'])
|
if ($where['excel'])
|
||||||
$list = $model->select();
|
$list = $model->select();
|
||||||
@ -604,8 +640,10 @@ class User extends BaseModel
|
|||||||
$count = self::setCommissionWhere($where)->count();
|
$count = self::setCommissionWhere($where)->count();
|
||||||
return ['data' => $list, 'count' => $count];
|
return ['data' => $list, 'count' => $count];
|
||||||
}
|
}
|
||||||
|
|
||||||
//获取佣金记录列表的查询条件
|
//获取佣金记录列表的查询条件
|
||||||
public static function setCommissionWhere($where){
|
public static function setCommissionWhere($where)
|
||||||
|
{
|
||||||
$models = self::setWherePage(self::alias('A'), $where, [], ['A.nickname', 'A.uid'])
|
$models = self::setWherePage(self::alias('A'), $where, [], ['A.nickname', 'A.uid'])
|
||||||
->join('user_bill B', 'B.uid=A.uid')
|
->join('user_bill B', 'B.uid=A.uid')
|
||||||
->group('A.uid')
|
->group('A.uid')
|
||||||
@ -635,14 +673,17 @@ class User extends BaseModel
|
|||||||
}
|
}
|
||||||
|
|
||||||
//获取某人用户推广信息
|
//获取某人用户推广信息
|
||||||
public static function getUserinfo($uid){
|
public static function getUserinfo($uid)
|
||||||
|
{
|
||||||
$userinfo = self::where('uid', $uid)->field('nickname,spread_uid,now_money,add_time')->find()->toArray();
|
$userinfo = self::where('uid', $uid)->field('nickname,spread_uid,now_money,add_time')->find()->toArray();
|
||||||
$userinfo['number'] = (float)UserBill::where('category', 'now_money')->where('uid', $uid)->where('type', 'brokerage')->sum('number');
|
$userinfo['number'] = (float)UserBill::where('category', 'now_money')->where('uid', $uid)->where('type', 'brokerage')->sum('number');
|
||||||
$userinfo['spread_name'] = $userinfo['spread_uid'] ? self::where('uid', $userinfo['spread_uid'])->value('nickname') : '';
|
$userinfo['spread_name'] = $userinfo['spread_uid'] ? self::where('uid', $userinfo['spread_uid'])->value('nickname') : '';
|
||||||
return $userinfo;
|
return $userinfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
//获取某用户的详细信息
|
//获取某用户的详细信息
|
||||||
public static function getUserDetailed($uid){
|
public static function getUserDetailed($uid)
|
||||||
|
{
|
||||||
$key_field = ['real_name', 'phone', 'province', 'city', 'district', 'detail', 'post_code'];
|
$key_field = ['real_name', 'phone', 'province', 'city', 'district', 'detail', 'post_code'];
|
||||||
$Address = ($thisAddress = Db::name('user_address')->where('uid', $uid)->where('is_default', 1)->field($key_field)->find()) ?
|
$Address = ($thisAddress = Db::name('user_address')->where('uid', $uid)->where('is_default', 1)->field($key_field)->find()) ?
|
||||||
$thisAddress :
|
$thisAddress :
|
||||||
@ -664,8 +705,10 @@ class User extends BaseModel
|
|||||||
['name' => '提现总金额', 'value' => Db::name('user_extract')->where('uid', $uid)->where('status', 1)->sum('extract_price')],
|
['name' => '提现总金额', 'value' => Db::name('user_extract')->where('uid', $uid)->where('status', 1)->sum('extract_price')],
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
//获取某用户的订单个数,消费明细
|
//获取某用户的订单个数,消费明细
|
||||||
public static function getHeaderList($uid){
|
public static function getHeaderList($uid)
|
||||||
|
{
|
||||||
return [
|
return [
|
||||||
[
|
[
|
||||||
'title' => '总计订单',
|
'title' => '总计订单',
|
||||||
@ -693,6 +736,7 @@ class User extends BaseModel
|
|||||||
]
|
]
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* 获取 会员 订单个数,积分明细,优惠劵明细
|
* 获取 会员 订单个数,积分明细,优惠劵明细
|
||||||
*
|
*
|
||||||
@ -700,7 +744,8 @@ class User extends BaseModel
|
|||||||
*
|
*
|
||||||
* return array
|
* return array
|
||||||
*/
|
*/
|
||||||
public static function getCountInfo($uid){
|
public static function getCountInfo($uid)
|
||||||
|
{
|
||||||
$order_count = StoreOrder::where('uid', $uid)->count();
|
$order_count = StoreOrder::where('uid', $uid)->count();
|
||||||
$integral_count = UserBill::where('uid', $uid)->where('category', 'integral')->where('type', 'in', 'deduction,system_add')->count();
|
$integral_count = UserBill::where('uid', $uid)->where('category', 'integral')->where('type', 'in', 'deduction,system_add')->count();
|
||||||
$sign_count = UserBill::where('type', 'sign')->where('uid', $uid)->where('category', 'integral')->count();
|
$sign_count = UserBill::where('type', 'sign')->where('uid', $uid)->where('category', 'integral')->count();
|
||||||
@ -711,6 +756,7 @@ class User extends BaseModel
|
|||||||
$spread_count = self::where('spread_uid', $uid)->count();
|
$spread_count = self::where('spread_uid', $uid)->count();
|
||||||
return compact('order_count', 'integral_count', 'sign_count', 'balanceChang_count', 'coupon_count', 'spread_count');
|
return compact('order_count', 'integral_count', 'sign_count', 'balanceChang_count', 'coupon_count', 'spread_count');
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* 获取 会员业务的
|
* 获取 会员业务的
|
||||||
* 购物会员统计
|
* 购物会员统计
|
||||||
@ -722,7 +768,8 @@ class User extends BaseModel
|
|||||||
*
|
*
|
||||||
* return array
|
* return array
|
||||||
*/
|
*/
|
||||||
public static function getUserBusinessChart($where,$limit=20){
|
public static function getUserBusinessChart($where, $limit = 20)
|
||||||
|
{
|
||||||
//获取购物会员人数趋势图
|
//获取购物会员人数趋势图
|
||||||
$list = self::getModelTime($where, self::where('a.status', 1)->alias('a')->join('store_order r', 'r.uid=a.uid'), 'a.add_time')
|
$list = self::getModelTime($where, self::where('a.status', 1)->alias('a')->join('store_order r', 'r.uid=a.uid'), 'a.add_time')
|
||||||
->where('r.paid', 1)
|
->where('r.paid', 1)
|
||||||
@ -784,6 +831,7 @@ class User extends BaseModel
|
|||||||
];
|
];
|
||||||
return compact('seriesdata', 'xdata', 'zoom', 'visit_data', 'visit_xdata', 'visit_zoom', 'shop_data', 'shop_xdata');
|
return compact('seriesdata', 'xdata', 'zoom', 'visit_data', 'visit_xdata', 'visit_zoom', 'shop_data', 'shop_xdata');
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* 获取用户
|
* 获取用户
|
||||||
* 积分排行
|
* 积分排行
|
||||||
@ -796,7 +844,8 @@ class User extends BaseModel
|
|||||||
* $limit 查询多少条
|
* $limit 查询多少条
|
||||||
* return array
|
* return array
|
||||||
*/
|
*/
|
||||||
public static function getUserTop10List($limit=10,$is_promoter=0){
|
public static function getUserTop10List($limit = 10, $is_promoter = 0)
|
||||||
|
{
|
||||||
//积分排行
|
//积分排行
|
||||||
$integral = self::where('status', 1)
|
$integral = self::where('status', 1)
|
||||||
->where('is_promoter', $is_promoter)
|
->where('is_promoter', $is_promoter)
|
||||||
@ -858,6 +907,7 @@ class User extends BaseModel
|
|||||||
count($lastorder) && $lastorder = $lastorder->toArray();
|
count($lastorder) && $lastorder = $lastorder->toArray();
|
||||||
return compact('integral', 'now_money', 'shopcount', 'order', 'lastorder');
|
return compact('integral', 'now_money', 'shopcount', 'order', 'lastorder');
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* 获取 会员业务
|
* 获取 会员业务
|
||||||
* 会员总余额 会员总积分
|
* 会员总余额 会员总积分
|
||||||
@ -865,7 +915,8 @@ class User extends BaseModel
|
|||||||
*
|
*
|
||||||
* return array
|
* return array
|
||||||
*/
|
*/
|
||||||
public static function getUserBusinesHeade($where){
|
public static function getUserBusinesHeade($where)
|
||||||
|
{
|
||||||
return [
|
return [
|
||||||
[
|
[
|
||||||
'name' => '会员总余额',
|
'name' => '会员总余额',
|
||||||
@ -883,6 +934,7 @@ class User extends BaseModel
|
|||||||
]
|
]
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* 分销会员头部信息查询获取
|
* 分销会员头部信息查询获取
|
||||||
*
|
*
|
||||||
@ -896,7 +948,8 @@ class User extends BaseModel
|
|||||||
*
|
*
|
||||||
* return array
|
* return array
|
||||||
*/
|
*/
|
||||||
public static function getDistributionBadgeList($where){
|
public static function getDistributionBadgeList($where)
|
||||||
|
{
|
||||||
$timeList = [
|
$timeList = [
|
||||||
'today' => implode(' - ', [date('Y/m/d'), date('Y/m/d', strtotime('+1 day'))]),
|
'today' => implode(' - ', [date('Y/m/d'), date('Y/m/d', strtotime('+1 day'))]),
|
||||||
'week' => implode(' - ', [
|
'week' => implode(' - ', [
|
||||||
@ -969,6 +1022,7 @@ class User extends BaseModel
|
|||||||
],
|
],
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* 分销会员
|
* 分销会员
|
||||||
* 分销数量 饼状图
|
* 分销数量 饼状图
|
||||||
@ -979,7 +1033,8 @@ class User extends BaseModel
|
|||||||
* $limit int n条数据后出拖动条
|
* $limit int n条数据后出拖动条
|
||||||
* return array
|
* return array
|
||||||
*/
|
*/
|
||||||
public static function getUserDistributionChart($where,$limit=20){
|
public static function getUserDistributionChart($where, $limit = 20)
|
||||||
|
{
|
||||||
//分销数量
|
//分销数量
|
||||||
$fenbu_user = self::getModelTime($where, new self)->field('count(uid) as num')->group('is_promoter')->select();
|
$fenbu_user = self::getModelTime($where, new self)->field('count(uid) as num')->group('is_promoter')->select();
|
||||||
count($fenbu_user) && $fenbu_user = $fenbu_user->toArray();
|
count($fenbu_user) && $fenbu_user = $fenbu_user->toArray();
|
||||||
@ -1059,13 +1114,15 @@ class User extends BaseModel
|
|||||||
];
|
];
|
||||||
return compact('fenbu_data', 'fenbu_xdata', 'visit_data', 'visit_xdata', 'visit_zoom', 'seriesdata', 'xdata', 'zoom', 'shop_xdata', 'shop_data');
|
return compact('fenbu_data', 'fenbu_xdata', 'visit_data', 'visit_xdata', 'visit_zoom', 'seriesdata', 'xdata', 'zoom', 'shop_xdata', 'shop_data');
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* 分销商佣金提现排行榜
|
* 分销商佣金提现排行榜
|
||||||
* 分销商佣金总额排行榜
|
* 分销商佣金总额排行榜
|
||||||
* $limit 截取条数
|
* $limit 截取条数
|
||||||
* return array
|
* return array
|
||||||
*/
|
*/
|
||||||
public static function getUserDistributionTop10List($limit){
|
public static function getUserDistributionTop10List($limit)
|
||||||
|
{
|
||||||
//分销商佣金提现排行榜
|
//分销商佣金提现排行榜
|
||||||
$extract = self::alias('a')
|
$extract = self::alias('a')
|
||||||
->join('user_extract t', 'a.uid=t.uid')
|
->join('user_extract t', 'a.uid=t.uid')
|
||||||
@ -1092,7 +1149,9 @@ class User extends BaseModel
|
|||||||
count($commission) && $commission = $commission->toArray();
|
count($commission) && $commission = $commission->toArray();
|
||||||
return compact('extract', 'commission');
|
return compact('extract', 'commission');
|
||||||
}
|
}
|
||||||
public static function getSpreadList($uid,$page,$limit){
|
|
||||||
|
public static function getSpreadList($uid, $page, $limit)
|
||||||
|
{
|
||||||
$list = self::where('spread_uid', $uid)->field('uid,nickname,now_money,integral,add_time')
|
$list = self::where('spread_uid', $uid)->field('uid,nickname,now_money,integral,add_time')
|
||||||
->order('uid desc')->page((int)$page, (int)$limit)->select();
|
->order('uid desc')->page((int)$page, (int)$limit)->select();
|
||||||
count($list) && $list = $list->toArray();
|
count($list) && $list = $list->toArray();
|
||||||
@ -1101,6 +1160,7 @@ class User extends BaseModel
|
|||||||
}
|
}
|
||||||
return $list;
|
return $list;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 一级分销
|
* 一级分销
|
||||||
* @param $orderInfo
|
* @param $orderInfo
|
||||||
@ -1110,11 +1170,11 @@ class User extends BaseModel
|
|||||||
{
|
{
|
||||||
$userInfo = User::getUserInfo($orderInfo['uid']);
|
$userInfo = User::getUserInfo($orderInfo['uid']);
|
||||||
if (!$userInfo || !$userInfo['spread_uid']) return true;
|
if (!$userInfo || !$userInfo['spread_uid']) return true;
|
||||||
$storeBrokerageStatu = sysConfig('store_brokerage_statu') ? : 1;//获取后台分销类型
|
$storeBrokerageStatu = sys_config('store_brokerage_statu') ?: 1;//获取后台分销类型
|
||||||
if ($storeBrokerageStatu == 1) {
|
if ($storeBrokerageStatu == 1) {
|
||||||
if (!User::be(['uid' => $userInfo['spread_uid'], 'is_promoter' => 1])) return true;
|
if (!User::be(['uid' => $userInfo['spread_uid'], 'is_promoter' => 1])) return true;
|
||||||
}
|
}
|
||||||
$brokerageRatio = (sysConfig('store_brokerage_ratio') ?: 0)/100;
|
$brokerageRatio = (sys_config('store_brokerage_ratio') ?: 0) / 100;
|
||||||
if ($brokerageRatio <= 0) return true;
|
if ($brokerageRatio <= 0) return true;
|
||||||
$cost = isset($orderInfo['cost']) ? $orderInfo['cost'] : 0;//成本价
|
$cost = isset($orderInfo['cost']) ? $orderInfo['cost'] : 0;//成本价
|
||||||
if ($cost > $orderInfo['pay_price']) return true;//成本价大于支付价格时直接返回
|
if ($cost > $orderInfo['pay_price']) return true;//成本价大于支付价格时直接返回
|
||||||
@ -1138,15 +1198,16 @@ class User extends BaseModel
|
|||||||
* @param $orderInfo
|
* @param $orderInfo
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
public static function backOrderBrokerageTwo($orderInfo){
|
public static function backOrderBrokerageTwo($orderInfo)
|
||||||
|
{
|
||||||
$userInfo = User::getUserInfo($orderInfo['uid']);
|
$userInfo = User::getUserInfo($orderInfo['uid']);
|
||||||
$userInfoTwo = User::getUserInfo($userInfo['spread_uid']);
|
$userInfoTwo = User::getUserInfo($userInfo['spread_uid']);
|
||||||
if (!$userInfoTwo || !$userInfoTwo['spread_uid']) return true;
|
if (!$userInfoTwo || !$userInfoTwo['spread_uid']) return true;
|
||||||
$storeBrokerageStatu = sysConfig('store_brokerage_statu') ? : 1;//获取后台分销类型
|
$storeBrokerageStatu = sys_config('store_brokerage_statu') ?: 1;//获取后台分销类型
|
||||||
if ($storeBrokerageStatu == 1) {
|
if ($storeBrokerageStatu == 1) {
|
||||||
if (!User::be(['uid' => $userInfoTwo['spread_uid'], 'is_promoter' => 1])) return true;
|
if (!User::be(['uid' => $userInfoTwo['spread_uid'], 'is_promoter' => 1])) return true;
|
||||||
}
|
}
|
||||||
$brokerageRatio = (sysConfig('store_brokerage_two') ?: 0)/100;
|
$brokerageRatio = (sys_config('store_brokerage_two') ?: 0) / 100;
|
||||||
if ($brokerageRatio <= 0) return true;
|
if ($brokerageRatio <= 0) return true;
|
||||||
$cost = isset($orderInfo['cost']) ? $orderInfo['cost'] : 0;//成本价
|
$cost = isset($orderInfo['cost']) ? $orderInfo['cost'] : 0;//成本价
|
||||||
if ($cost > $orderInfo['pay_price']) return true;//成本价大于支付价格时直接返回
|
if ($cost > $orderInfo['pay_price']) return true;//成本价大于支付价格时直接返回
|
||||||
|
|||||||
@ -5,6 +5,7 @@
|
|||||||
* Date: 2018-03-03
|
* Date: 2018-03-03
|
||||||
* Time: 16:47
|
* Time: 16:47
|
||||||
*/
|
*/
|
||||||
|
|
||||||
namespace app\admin\model\user;
|
namespace app\admin\model\user;
|
||||||
|
|
||||||
use app\admin\model\wechat\WechatUser;
|
use app\admin\model\wechat\WechatUser;
|
||||||
@ -112,12 +113,7 @@ class UserExtract extends BaseModel
|
|||||||
'remark' => '错误原因:' . $fail_msg
|
'remark' => '错误原因:' . $fail_msg
|
||||||
], Url::buildUrl('/user/cashrecord')->suffix('')->domain(true)->build());
|
], Url::buildUrl('/user/cashrecord')->suffix('')->domain(true)->build());
|
||||||
} else if (strtolower($User['user_type']) == 'routine') {
|
} else if (strtolower($User['user_type']) == 'routine') {
|
||||||
RoutineTemplate::sendOut('USER_EXTRACT_FALSE',$uid,[
|
RoutineTemplate::sendExtractFail($uid, $fail_msg, $extract_number, $User['nickname']);
|
||||||
'keyword1'=>$fail_msg,
|
|
||||||
'keyword2'=>$extract_number,
|
|
||||||
'keyword3'=>$extract_type,
|
|
||||||
'keyword4'=>date('Y-m-d H:i:s',time()),
|
|
||||||
]);
|
|
||||||
}
|
}
|
||||||
return self::edit(compact('fail_time', 'fail_msg', 'status'), $id);
|
return self::edit(compact('fail_time', 'fail_msg', 'status'), $id);
|
||||||
}
|
}
|
||||||
@ -128,7 +124,7 @@ class UserExtract extends BaseModel
|
|||||||
$data = self::get($id);
|
$data = self::get($id);
|
||||||
$extractNumber = $data['extract_price'];
|
$extractNumber = $data['extract_price'];
|
||||||
$mark = '成功提现佣金' . $extractNumber . '元';
|
$mark = '成功提现佣金' . $extractNumber . '元';
|
||||||
$wechatUserInfo = WechatUser::where('uid',$data['uid'])->field('openid,user_type,routine_openid')->find();
|
$wechatUserInfo = WechatUser::where('uid', $data['uid'])->field('openid,user_type,routine_openid,nickname')->find();
|
||||||
$extract_type = '未知方式';
|
$extract_type = '未知方式';
|
||||||
switch ($data['extract_type']) {
|
switch ($data['extract_type']) {
|
||||||
case 'alipay':
|
case 'alipay':
|
||||||
@ -143,12 +139,7 @@ class UserExtract extends BaseModel
|
|||||||
}
|
}
|
||||||
if ($wechatUserInfo) {
|
if ($wechatUserInfo) {
|
||||||
if (strtolower($wechatUserInfo->user_type) == 'routine') {
|
if (strtolower($wechatUserInfo->user_type) == 'routine') {
|
||||||
RoutineTemplate::sendOut('USER_EXTRACT_TRUE',$data['uid'],[
|
RoutineTemplate::sendExtractSuccess($data['uid'], $extractNumber, $wechatUserInfo->nickname);
|
||||||
'keyword1'=>$extractNumber.'元',
|
|
||||||
'keyword2'=>'审核成功',
|
|
||||||
'keyword3'=>date('Y-m-d H:i:s', time()),
|
|
||||||
'keyword4'=>$extract_type,
|
|
||||||
]);
|
|
||||||
} else if (strtolower($wechatUserInfo->user_type) == 'wechat') {
|
} else if (strtolower($wechatUserInfo->user_type) == 'wechat') {
|
||||||
WechatTemplateService::sendTemplate($wechatUserInfo->openid, WechatTemplateService::USER_BALANCE_CHANGE, [
|
WechatTemplateService::sendTemplate($wechatUserInfo->openid, WechatTemplateService::USER_BALANCE_CHANGE, [
|
||||||
'first' => $mark,
|
'first' => $mark,
|
||||||
@ -161,8 +152,10 @@ class UserExtract extends BaseModel
|
|||||||
}
|
}
|
||||||
return self::edit(['status' => 1], $id);
|
return self::edit(['status' => 1], $id);
|
||||||
}
|
}
|
||||||
|
|
||||||
//测试数据
|
//测试数据
|
||||||
public static function test(){
|
public static function test()
|
||||||
|
{
|
||||||
$uids = User::order('uid desc')->limit(2, 20)->field(['uid', 'nickname'])->select()->toArray();
|
$uids = User::order('uid desc')->limit(2, 20)->field(['uid', 'nickname'])->select()->toArray();
|
||||||
$type = ['bank', 'alipay', 'weixin'];
|
$type = ['bank', 'alipay', 'weixin'];
|
||||||
foreach ($uids as $item) {
|
foreach ($uids as $item) {
|
||||||
@ -182,8 +175,10 @@ class UserExtract extends BaseModel
|
|||||||
self::create($data);
|
self::create($data);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//获取头部提现信息
|
//获取头部提现信息
|
||||||
public static function getExtractHead(){
|
public static function getExtractHead()
|
||||||
|
{
|
||||||
//本月提现人数
|
//本月提现人数
|
||||||
$month = self::getModelTime(['data' => 'month'], self::where('status', 1))->group('uid')->count();
|
$month = self::getModelTime(['data' => 'month'], self::where('status', 1))->group('uid')->count();
|
||||||
//本月提现笔数
|
//本月提现笔数
|
||||||
@ -272,8 +267,10 @@ class UserExtract extends BaseModel
|
|||||||
],
|
],
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
//获取提现分布图和提现人数金额曲线图
|
//获取提现分布图和提现人数金额曲线图
|
||||||
public static function getExtractList($where,$limit=15){
|
public static function getExtractList($where, $limit = 15)
|
||||||
|
{
|
||||||
$legdata = ['提现人数', '提现金额'];
|
$legdata = ['提现人数', '提现金额'];
|
||||||
$list = self::getModelTime($where, self::where('status', 1))
|
$list = self::getModelTime($where, self::where('status', 1))
|
||||||
->field('FROM_UNIXTIME(add_time,"%Y-%c-%d") as un_time,count(uid) as count,sum(extract_price) as sum_price')->group('un_time')->order('un_time asc')->select();
|
->field('FROM_UNIXTIME(add_time,"%Y-%c-%d") as un_time,count(uid) as count,sum(extract_price) as sum_price')->group('un_time')->order('un_time asc')->select();
|
||||||
@ -323,7 +320,8 @@ class UserExtract extends BaseModel
|
|||||||
* @param int $uid
|
* @param int $uid
|
||||||
* @return int|mixed
|
* @return int|mixed
|
||||||
*/
|
*/
|
||||||
public static function getUserCountPrice($uid = 0){
|
public static function getUserCountPrice($uid = 0)
|
||||||
|
{
|
||||||
if (!$uid) return 0;
|
if (!$uid) return 0;
|
||||||
$price = self::where('uid', $uid)->where('status', 1)->sum('extract_price');
|
$price = self::where('uid', $uid)->where('status', 1)->sum('extract_price');
|
||||||
return $price ? $price : 0;
|
return $price ? $price : 0;
|
||||||
@ -334,7 +332,8 @@ class UserExtract extends BaseModel
|
|||||||
* @param int $uid
|
* @param int $uid
|
||||||
* @return int|string
|
* @return int|string
|
||||||
*/
|
*/
|
||||||
public static function getUserCountNum($uid = 0){
|
public static function getUserCountNum($uid = 0)
|
||||||
|
{
|
||||||
if (!$uid) return 0;
|
if (!$uid) return 0;
|
||||||
return self::where('uid', $uid)->count();
|
return self::where('uid', $uid)->count();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -266,6 +266,7 @@
|
|||||||
{include file="public/style"}
|
{include file="public/style"}
|
||||||
<script>
|
<script>
|
||||||
window.newOrderAudioLink='{$new_order_audio_link}';
|
window.newOrderAudioLink='{$new_order_audio_link}';
|
||||||
|
window.workermanPort = '{$workermanPort}';
|
||||||
</script>
|
</script>
|
||||||
<script src="{__FRAME_PATH}js/index.js"></script>
|
<script src="{__FRAME_PATH}js/index.js"></script>
|
||||||
</body>
|
</body>
|
||||||
|
|||||||
35
crmeb/app/admin/view/order/store_order/order_spread_user.php
Normal file
35
crmeb/app/admin/view/order/store_order/order_spread_user.php
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
{extend name="public/container"}
|
||||||
|
{block name="content"}
|
||||||
|
<div class="ibox-content order-info">
|
||||||
|
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-sm-12">
|
||||||
|
<div class="panel panel-default">
|
||||||
|
<div class="panel-heading">
|
||||||
|
<img src="{$spread.avatar}" width="50" height="50" style="border-radius: 60px;" />
|
||||||
|
<span style="font-size: 16px">{$spread.nickname}</span>
|
||||||
|
</div>
|
||||||
|
<div class="panel-body">
|
||||||
|
<div class="row show-grid">
|
||||||
|
<div class="col-xs-6" style="color: #ff0005">余额:¥ {$spread.now_money}</div>
|
||||||
|
<div class="col-xs-6">UID:{$spread.uid}</div>
|
||||||
|
<div class="col-xs-6" style="color: green">佣金:¥ {$spread.brokerage_price}</div>
|
||||||
|
<div class="col-xs-6">真实姓名:{$spread.real_name}</div>
|
||||||
|
<div class="col-xs-6">身份证::{$spread.card_id}</div>
|
||||||
|
<div class="col-xs-6">手机号码:{$spread.phone}</div>
|
||||||
|
<div class="col-xs-6">生日:{$spread.birthday}</div>
|
||||||
|
<div class="col-xs-6">积分:{$spread.integral}</div>
|
||||||
|
<div class="col-xs-6">用户备注:{$spread.mark}</div>
|
||||||
|
<div class="col-xs-6">最后登录时间:{$spread.last_time|date="Y/m/d H:i"}</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<script src="{__FRAME_PATH}js/content.min.js?v=1.0.0"></script>
|
||||||
|
{/block}
|
||||||
|
{block name="script"}
|
||||||
|
|
||||||
|
{/block}
|
||||||
@ -70,11 +70,6 @@ class AuthController
|
|||||||
return app('json')->success('成功');
|
return app('json')->success('成功');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function test()
|
|
||||||
{
|
|
||||||
echo 'test';
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 验证码发送
|
* 验证码发送
|
||||||
* @param Request $request
|
* @param Request $request
|
||||||
|
|||||||
@ -12,7 +12,6 @@ use app\models\user\UserBill;
|
|||||||
use app\models\user\WechatUser;
|
use app\models\user\WechatUser;
|
||||||
use app\Request;
|
use app\Request;
|
||||||
use crmeb\services\GroupDataService;
|
use crmeb\services\GroupDataService;
|
||||||
use crmeb\services\SystemConfigService;
|
|
||||||
use crmeb\services\UploadService;
|
use crmeb\services\UploadService;
|
||||||
use crmeb\services\UtilService;
|
use crmeb\services\UtilService;
|
||||||
use crmeb\services\workerman\ChannelService;
|
use crmeb\services\workerman\ChannelService;
|
||||||
@ -38,28 +37,29 @@ class PublicController
|
|||||||
$menus = GroupDataService::getData('routine_home_menus') ?: [];//TODO 首页按钮
|
$menus = GroupDataService::getData('routine_home_menus') ?: [];//TODO 首页按钮
|
||||||
$roll = GroupDataService::getData('routine_home_roll_news') ?: [];//TODO 首页滚动新闻
|
$roll = GroupDataService::getData('routine_home_roll_news') ?: [];//TODO 首页滚动新闻
|
||||||
$activity = GroupDataService::getData('routine_home_activity', 3) ?: [];//TODO 首页活动区域图片
|
$activity = GroupDataService::getData('routine_home_activity', 3) ?: [];//TODO 首页活动区域图片
|
||||||
$site_name = sysConfig('site_name');
|
$site_name = sys_config('site_name');
|
||||||
$routine_index_page = GroupDataService::getData('routine_index_page');
|
$routine_index_page = GroupDataService::getData('routine_index_page');
|
||||||
$info['fastInfo'] = $routine_index_page[0]['fast_info'] ?? '';//sysConfig('fast_info');//TODO 快速选择简介
|
$info['fastInfo'] = $routine_index_page[0]['fast_info'] ?? '';//sys_config('fast_info');//TODO 快速选择简介
|
||||||
$info['bastInfo'] = $routine_index_page[0]['bast_info'] ?? '';//sysConfig('bast_info');//TODO 精品推荐简介
|
$info['bastInfo'] = $routine_index_page[0]['bast_info'] ?? '';//sys_config('bast_info');//TODO 精品推荐简介
|
||||||
$info['firstInfo'] = $routine_index_page[0]['first_info'] ?? '';//sysConfig('first_info');//TODO 首发新品简介
|
$info['firstInfo'] = $routine_index_page[0]['first_info'] ?? '';//sys_config('first_info');//TODO 首发新品简介
|
||||||
$info['salesInfo'] = $routine_index_page[0]['sales_info'] ?? '';//sysConfig('sales_info');//TODO 促销单品简介
|
$info['salesInfo'] = $routine_index_page[0]['sales_info'] ?? '';//sys_config('sales_info');//TODO 促销单品简介
|
||||||
$logoUrl = sysConfig('routine_index_logo');//TODO 促销单品简介
|
$logoUrl = sys_config('routine_index_logo');//TODO 促销单品简介
|
||||||
if (strstr($logoUrl, 'http') === false) $logoUrl = sysConfig('site_url') . $logoUrl;
|
if (strstr($logoUrl, 'http') === false && $logoUrl) $logoUrl = sys_config('site_url') . $logoUrl;
|
||||||
$logoUrl = str_replace('\\', '/', $logoUrl);
|
$logoUrl = str_replace('\\', '/', $logoUrl);
|
||||||
$fastNumber = $routine_index_page[0]['fast_number'] ?? 6;//sysConfig('fast_number');//TODO 快速选择分类个数
|
$fastNumber = $routine_index_page[0]['fast_number'] ?? 0;//sys_config('fast_number');//TODO 快速选择分类个数
|
||||||
$bastNumber = $routine_index_page[0]['bast_number'] ?? 6;//sysConfig('bast_number');//TODO 精品推荐个数
|
$bastNumber = $routine_index_page[0]['bast_number'] ?? 0;//sys_config('bast_number');//TODO 精品推荐个数
|
||||||
$firstNumber = $routine_index_page[0]['first_number'] ?? 6;//sysConfig('first_number');//TODO 首发新品个数
|
$firstNumber = $routine_index_page[0]['first_number'] ?? 0;//sys_config('first_number');//TODO 首发新品个数
|
||||||
$info['fastList'] = StoreCategory::byIndexList((int)$fastNumber);//TODO 快速选择分类个数
|
$info['fastList'] = StoreCategory::byIndexList((int)$fastNumber, false);//TODO 快速选择分类个数
|
||||||
$info['bastList'] = StoreProduct::getBestProduct('id,image,store_name,cate_id,price,ot_price,IFNULL(sales,0) + IFNULL(ficti,0) as sales,unit_name', (int)$bastNumber, $request->uid());//TODO 精品推荐个数
|
$info['bastList'] = StoreProduct::getBestProduct('id,image,store_name,cate_id,price,ot_price,IFNULL(sales,0) + IFNULL(ficti,0) as sales,unit_name', (int)$bastNumber, $request->uid(), false);//TODO 精品推荐个数
|
||||||
$info['firstList'] = StoreProduct::getNewProduct('id,image,store_name,cate_id,price,unit_name,IFNULL(sales,0) + IFNULL(ficti,0) as sales', (int)$firstNumber, $request->uid());//TODO 首发新品个数
|
$info['firstList'] = StoreProduct::getNewProduct('id,image,store_name,cate_id,price,unit_name,IFNULL(sales,0) + IFNULL(ficti,0) as sales', (int)$firstNumber, $request->uid(), false);//TODO 首发新品个数
|
||||||
$info['bastBanner'] = GroupDataService::getData('routine_home_bast_banner') ?? [];//TODO 首页精品推荐图片
|
$info['bastBanner'] = GroupDataService::getData('routine_home_bast_banner') ?? [];//TODO 首页精品推荐图片
|
||||||
$benefit = StoreProduct::getBenefitProduct('id,image,store_name,cate_id,price,ot_price,stock,unit_name', 3);//TODO 首页促销单品
|
$benefit = StoreProduct::getBenefitProduct('id,image,store_name,cate_id,price,ot_price,stock,unit_name', 3);//TODO 首页促销单品
|
||||||
$lovely = GroupDataService::getData('routine_home_new_banner') ?: [];//TODO 首发新品顶部图
|
$lovely = GroupDataService::getData('routine_home_new_banner') ?: [];//TODO 首发新品顶部图
|
||||||
$likeInfo = StoreProduct::getHotProduct('id,image,store_name,cate_id,price,unit_name', 3);//TODO 热门榜单 猜你喜欢
|
$likeInfo = StoreProduct::getHotProduct('id,image,store_name,cate_id,price,unit_name', 3);//TODO 热门榜单 猜你喜欢
|
||||||
$couponList = StoreCouponIssue::getIssueCouponList($request->uid(), 3);
|
$couponList = StoreCouponIssue::getIssueCouponList($request->uid(), 3);
|
||||||
$subscribe = WechatUser::where('uid', $request->uid() ?? 0)->value('subscribe') ? true : false;
|
$subscribe = WechatUser::where('uid', $request->uid() ?? 0)->value('subscribe') ? true : false;
|
||||||
return app('json')->successful(compact('banner', 'menus', 'roll', 'info', 'activity', 'lovely', 'benefit', 'likeInfo', 'logoUrl', 'couponList', 'site_name','subscribe'));
|
$newGoodsBananr = sys_config('new_goods_bananr');
|
||||||
|
return app('json')->successful(compact('banner', 'menus', 'roll', 'info', 'activity', 'lovely', 'benefit', 'likeInfo', 'logoUrl', 'couponList', 'site_name', 'subscribe','newGoodsBananr'));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -68,11 +68,11 @@ class PublicController
|
|||||||
*/
|
*/
|
||||||
public function share()
|
public function share()
|
||||||
{
|
{
|
||||||
$data['img'] = sysConfig('wechat_share_img');
|
$data['img'] = sys_config('wechat_share_img');
|
||||||
if (strstr($data['img'], 'http') === false) $data['img'] = sysConfig('site_url') . $data['img'];
|
if (strstr($data['img'], 'http') === false) $data['img'] = sys_config('site_url') . $data['img'];
|
||||||
$data['img'] = str_replace('\\', '/', $data['img']);
|
$data['img'] = str_replace('\\', '/', $data['img']);
|
||||||
$data['title'] = sysConfig('wechat_share_title');
|
$data['title'] = sys_config('wechat_share_title');
|
||||||
$data['synopsis'] = sysConfig('wechat_share_synopsis');
|
$data['synopsis'] = sys_config('wechat_share_synopsis');
|
||||||
return app('json')->successful(compact('data'));
|
return app('json')->successful(compact('data'));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -89,11 +89,11 @@ class PublicController
|
|||||||
{
|
{
|
||||||
$menusInfo = GroupDataService::getData('routine_my_menus') ?? [];
|
$menusInfo = GroupDataService::getData('routine_my_menus') ?? [];
|
||||||
$user = $request->user();
|
$user = $request->user();
|
||||||
$vipOpen = sysConfig('vip_open');
|
$vipOpen = sys_config('vip_open');
|
||||||
$vipOpen = is_string($vipOpen) ? (int)$vipOpen : $vipOpen;
|
$vipOpen = is_string($vipOpen) ? (int)$vipOpen : $vipOpen;
|
||||||
foreach ($menusInfo as $key => &$value) {
|
foreach ($menusInfo as $key => &$value) {
|
||||||
$value['pic'] = UtilService::setSiteUrl($value['pic']);
|
$value['pic'] = set_file_url($value['pic']);
|
||||||
if ($value['id'] == 137 && !(intval(sysConfig('store_brokerage_statu')) == 2 || $user->is_promoter == 1))
|
if ($value['id'] == 137 && !(intval(sys_config('store_brokerage_statu')) == 2 || $user->is_promoter == 1))
|
||||||
unset($menusInfo[$key]);
|
unset($menusInfo[$key]);
|
||||||
if ($value['id'] == 174 && !StoreService::orderServiceStatus($user->uid))
|
if ($value['id'] == 174 && !StoreService::orderServiceStatus($user->uid))
|
||||||
unset($menusInfo[$key]);
|
unset($menusInfo[$key]);
|
||||||
@ -149,7 +149,7 @@ class PublicController
|
|||||||
$start_uploads = 0;
|
$start_uploads = 0;
|
||||||
$start_uploads++;
|
$start_uploads++;
|
||||||
Cache::set('start_uploads_' . $request->uid(), $start_uploads, 86400);
|
Cache::set('start_uploads_' . $request->uid(), $start_uploads, 86400);
|
||||||
$res['dir'] = UploadService::pathToUrl($res['dir']);
|
$res['dir'] = path_to_url($res['dir']);
|
||||||
if (strpos($res['dir'], 'http') === false) $res['dir'] = $request->domain() . $res['dir'];
|
if (strpos($res['dir'], 'http') === false) $res['dir'] = $request->domain() . $res['dir'];
|
||||||
return app('json')->successful('图片上传成功!', ['name' => $res['name'], 'url' => $res['dir']]);
|
return app('json')->successful('图片上传成功!', ['name' => $res['name'], 'url' => $res['dir']]);
|
||||||
}
|
}
|
||||||
@ -210,8 +210,8 @@ class PublicController
|
|||||||
['code', ''],
|
['code', ''],
|
||||||
], $request, true);
|
], $request, true);
|
||||||
try {
|
try {
|
||||||
$code = $codeUrl ? UtilService::setImageBase64($codeUrl) : false;
|
$code = $codeUrl ? image_to_base64($codeUrl) : false;
|
||||||
$image = $imageUrl ? UtilService::setImageBase64($imageUrl) : false;
|
$image = $imageUrl ? image_to_base64($imageUrl) : false;
|
||||||
return app('json')->successful(compact('code', 'image'));
|
return app('json')->successful(compact('code', 'image'));
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
return app('json')->fail($e->getMessage());
|
return app('json')->fail($e->getMessage());
|
||||||
|
|||||||
@ -4,8 +4,10 @@
|
|||||||
namespace app\api\controller\wechat;
|
namespace app\api\controller\wechat;
|
||||||
|
|
||||||
|
|
||||||
|
use app\models\routine\RoutineTemplate;
|
||||||
use app\models\user\WechatUser;
|
use app\models\user\WechatUser;
|
||||||
use app\Request;
|
use app\Request;
|
||||||
|
use crmeb\services\CacheService;
|
||||||
use crmeb\services\MiniProgramService;
|
use crmeb\services\MiniProgramService;
|
||||||
use crmeb\services\UtilService;
|
use crmeb\services\UtilService;
|
||||||
use app\models\user\UserToken;
|
use app\models\user\UserToken;
|
||||||
@ -13,6 +15,7 @@ use crmeb\services\SystemConfigService;
|
|||||||
use app\models\user\User;
|
use app\models\user\User;
|
||||||
use app\models\routine\RoutineFormId;
|
use app\models\routine\RoutineFormId;
|
||||||
use think\facade\Cache;
|
use think\facade\Cache;
|
||||||
|
use crmeb\services\SubscribeTemplateService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 小程序相关
|
* 小程序相关
|
||||||
@ -99,16 +102,16 @@ class AuthController
|
|||||||
$logoType = $request->get('type', 1);
|
$logoType = $request->get('type', 1);
|
||||||
switch ((int)$logoType) {
|
switch ((int)$logoType) {
|
||||||
case 1:
|
case 1:
|
||||||
$logo = sysConfig('routine_logo');
|
$logo = sys_config('routine_logo');
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
$logo = sysConfig('wechat_avatar');
|
$logo = sys_config('wechat_avatar');
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
$logo = '';
|
$logo = '';
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (strstr($logo,'http') === false && $logo) $logo = sysConfig('site_url').$logo;
|
if (strstr($logo, 'http') === false && $logo) $logo = sys_config('site_url') . $logo;
|
||||||
return app('json')->successful(['logo_url' => str_replace('\\', '/', $logo)]);
|
return app('json')->successful(['logo_url' => str_replace('\\', '/', $logo)]);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -132,4 +135,21 @@ class AuthController
|
|||||||
{
|
{
|
||||||
MiniProgramService::handleNotify();
|
MiniProgramService::handleNotify();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取小程序订阅消息id
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
|
public function teml_ids()
|
||||||
|
{
|
||||||
|
$temlIdsName = SubscribeTemplateService::getConstants();
|
||||||
|
$temlIdsList = CacheService::get('TEML_IDS_LIST', function () use ($temlIdsName) {
|
||||||
|
$temlId = [];
|
||||||
|
foreach ($temlIdsName as $key => $item) {
|
||||||
|
$temlId[strtolower($key)] = SubscribeTemplateService::setTemplateId($item);
|
||||||
|
}
|
||||||
|
return $temlId;
|
||||||
|
});
|
||||||
|
return app('json')->success($temlIdsList);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@ -8,8 +8,8 @@ use app\models\user\User;
|
|||||||
use app\models\user\UserToken;
|
use app\models\user\UserToken;
|
||||||
use app\models\user\WechatUser;
|
use app\models\user\WechatUser;
|
||||||
use app\Request;
|
use app\Request;
|
||||||
use crmeb\utils\Canvas;
|
|
||||||
use crmeb\services\WechatService;
|
use crmeb\services\WechatService;
|
||||||
|
use crmeb\utils\Canvas;
|
||||||
use think\facade\Cookie;
|
use think\facade\Cookie;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -25,6 +25,7 @@ class WechatController
|
|||||||
*/
|
*/
|
||||||
public function serve()
|
public function serve()
|
||||||
{
|
{
|
||||||
|
ob_clean();
|
||||||
return WechatService::serve();
|
return WechatService::serve();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -33,6 +34,7 @@ class WechatController
|
|||||||
*/
|
*/
|
||||||
public function notify()
|
public function notify()
|
||||||
{
|
{
|
||||||
|
ob_clean();
|
||||||
WechatService::handleNotify();
|
WechatService::handleNotify();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -61,7 +63,7 @@ class WechatController
|
|||||||
try {
|
try {
|
||||||
$wechatInfo = WechatService::oauthService()->user()->getOriginal();
|
$wechatInfo = WechatService::oauthService()->user()->getOriginal();
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
return app('json')->fail('授权失败');
|
return app('json')->fail('授权失败', ['message' => $e->getMessage(), 'line' => $e->getLine()]);
|
||||||
}
|
}
|
||||||
if (!isset($wechatInfo['nickname'])) {
|
if (!isset($wechatInfo['nickname'])) {
|
||||||
$wechatInfo = WechatService::getUserInfo($wechatInfo['openid']);
|
$wechatInfo = WechatService::getUserInfo($wechatInfo['openid']);
|
||||||
@ -99,12 +101,13 @@ class WechatController
|
|||||||
$path = 'uploads/follow/';
|
$path = 'uploads/follow/';
|
||||||
$imageType = 'jpg';
|
$imageType = 'jpg';
|
||||||
$name = 'follow';
|
$name = 'follow';
|
||||||
$siteUrl = sysConfig('site_url');
|
$siteUrl = sys_config('site_url');
|
||||||
if (file_exists($path . $name . '.' . $imageType)) {
|
$imageUrl = $path . $name . '.' . $imageType;
|
||||||
return app('json')->success('ok', ['path' => $siteUrl . '/' . $path . $name . '.' . $imageType]);
|
if (file_exists($imageUrl)) {
|
||||||
|
return app('json')->success('ok', ['path' => $siteUrl . '/' . $imageUrl]);
|
||||||
}
|
}
|
||||||
$canvas->setImageUrl('static/qrcode/follow.png')->setImageHeight(720)->setImageWidth(500)->pushImageValue();
|
$canvas->setImageUrl('static/qrcode/follow.png')->setImageHeight(720)->setImageWidth(500)->pushImageValue();
|
||||||
$wechatQrcode = sysConfig('wechat_qrcode');
|
$wechatQrcode = sys_config('wechat_qrcode');
|
||||||
if (($strlen = stripos($wechatQrcode, 'uploads')) !== false) {
|
if (($strlen = stripos($wechatQrcode, 'uploads')) !== false) {
|
||||||
$wechatQrcode = substr($wechatQrcode, $strlen);
|
$wechatQrcode = substr($wechatQrcode, $strlen);
|
||||||
}
|
}
|
||||||
@ -114,5 +117,4 @@ class WechatController
|
|||||||
$image = $canvas->setFileName($name)->setImageType($imageType)->setPath($path)->setBackgroundWidth(500)->setBackgroundHeight(720)->starDrawChart();
|
$image = $canvas->setFileName($name)->setImageType($imageType)->setPath($path)->setBackgroundWidth(500)->setBackgroundHeight(720)->starDrawChart();
|
||||||
return app('json')->success('ok', ['path' => $image ? $siteUrl . '/' . $image : '']);
|
return app('json')->success('ok', ['path' => $image ? $siteUrl . '/' . $image : '']);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -2,6 +2,8 @@
|
|||||||
|
|
||||||
namespace app\models\routine;
|
namespace app\models\routine;
|
||||||
|
|
||||||
|
use app\admin\model\wechat\StoreService as ServiceModel;
|
||||||
|
use crmeb\basic\BaseModel;
|
||||||
use crmeb\utils\Template;
|
use crmeb\utils\Template;
|
||||||
use app\models\store\StoreOrder;
|
use app\models\store\StoreOrder;
|
||||||
use app\models\user\WechatUser;
|
use app\models\user\WechatUser;
|
||||||
@ -12,7 +14,7 @@ use app\models\user\WechatUser;
|
|||||||
* Class RoutineTemplate
|
* Class RoutineTemplate
|
||||||
* @package app\models\routine
|
* @package app\models\routine
|
||||||
*/
|
*/
|
||||||
class RoutineTemplate
|
class RoutineTemplate extends BaseModel
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* 数据表主键
|
* 数据表主键
|
||||||
@ -26,51 +28,99 @@ class RoutineTemplate
|
|||||||
*/
|
*/
|
||||||
protected $name = 'routine_template';
|
protected $name = 'routine_template';
|
||||||
|
|
||||||
public static function sendOrderTakeOver()
|
/**
|
||||||
|
* 确认收货
|
||||||
|
* @param $order
|
||||||
|
* @param $title
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
public static function sendOrderTakeOver($order, $title)
|
||||||
{
|
{
|
||||||
|
return self::sendOut('OREDER_TAKEVER', $order['uid'], [
|
||||||
|
'thing1' => $order['order_id'],
|
||||||
|
'thing2' => $title,
|
||||||
|
'date5' => date('Y-m-d H:i:s', time()),
|
||||||
|
], '/pages/order_details/index?order_id=' . $order['order_id']);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 送货和发货
|
* 送货和发货
|
||||||
* @param $order
|
* @param $order
|
||||||
* @param int $isGive
|
* @param int $isGive 0 = 同城配送, 1 = 快递发货
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
public static function sendOrderPostage($order, $isGive = 0)
|
public static function sendOrderPostage($order, $isGive = 0)
|
||||||
{
|
{
|
||||||
if ($isGive) {
|
if (is_string($order['cart_id']))
|
||||||
$data['keyword1'] = $order['order_id'];
|
$order['cart_id'] = json_decode($order['cart_id'], true);
|
||||||
$data['keyword2'] = $order['delivery_name'];
|
$storeTitle = StoreOrder::getProductTitle($order['cart_id']);
|
||||||
$data['keyword3'] = $order['delivery_id'];
|
$storeTitle = StoreOrder::getSubstrUTf8($storeTitle, 20,'UTF-8','');
|
||||||
$data['keyword4'] = date('Y-m-d H:i:s', time());
|
if ($isGive) {//快递发货
|
||||||
$data['keyword5'] = '您的商品已经发货请注意查收';
|
return self::sendOut('ORDER_DELIVER_SUCCESS', $order['uid'], [
|
||||||
return self::sendOut('ORDER_POSTAGE_SUCCESS', $order['uid'], $data);
|
'character_string2' => $order['delivery_id'],
|
||||||
} else {
|
'thing1' => $order['delivery_name'],
|
||||||
$data['keyword1'] = $order['order_id'];
|
'time3' => date('Y-m-d H:i:s', time()),
|
||||||
$data['keyword2'] = $order['delivery_name'];
|
'thing5' => $storeTitle,
|
||||||
$data['keyword3'] = $order['delivery_id'];
|
], '/pages/order_details/index?order_id=' . $order['order_id']);
|
||||||
$data['keyword4'] = date('Y-m-d H:i:s', time());
|
} else {//同城配送
|
||||||
return self::sendOut('ORDER_DELIVER_SUCCESS', $order['uid'], $data);
|
return self::sendOut('ORDER_POSTAGE_SUCCESS', $order['uid'], [
|
||||||
|
'thing8' => $storeTitle,
|
||||||
|
'character_string1' => $order['order_id'],
|
||||||
|
'name4' => $order['delivery_name'],
|
||||||
|
'phone_number10' => $order['delivery_id']
|
||||||
|
], '/pages/order_details/index?order_id=' . $order['order_id']);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 退款成功发送消息
|
* 充值金额退款
|
||||||
|
* @param $UserRecharge
|
||||||
|
* @param $refund_price
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
public static function sendRechargeSuccess($UserRecharge, $refund_price)
|
||||||
|
{
|
||||||
|
return self::sendOut('ORDER_REFUND', $UserRecharge['uid'], [
|
||||||
|
'thing1' => '亲,您充值的金额已退款,本次退款' . $refund_price . '金额',
|
||||||
|
'thing2' => '余额充值退款',
|
||||||
|
'amount3' => $UserRecharge['price'],
|
||||||
|
'character_string6' => $UserRecharge['order_id'],
|
||||||
|
], '/pages/user_bill/index?type=2');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 订单退款成功发送消息
|
||||||
* @param array $order
|
* @param array $order
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
public static function sendOrderRefundSuccess($order = array())
|
public static function sendOrderRefundSuccess($order = array())
|
||||||
{
|
{
|
||||||
if (!$order) return false;
|
if (!$order) return false;
|
||||||
$data['keyword1'] = $order['order_id'];
|
if (is_string($order['cart_id']))
|
||||||
$data['keyword2'] = date('Y-m-d H:i:s', time());
|
$order['cart_id'] = json_decode($order['cart_id'], true);
|
||||||
$data['keyword3'] = $order['pay_price'];
|
$storeTitle = StoreOrder::getProductTitle($order['cart_id']);
|
||||||
if ($order['pay_type'] == 'yue') $data['keyword4'] = '余额支付';
|
$storeTitle = StoreOrder::getSubstrUTf8($storeTitle, 20,'UTF-8','');
|
||||||
else if ($order['pay_type'] == 'weixin') $data['keyword4'] = '微信支付';
|
return self::sendOut('ORDER_REFUND', $order['uid'], [
|
||||||
else if ($order['pay_type'] == 'offline') $data['keyword4'] = '线下支付';
|
'thing1' => '已成功退款',
|
||||||
$data['keyword5']['value'] = '已成功退款';
|
'thing2' => $storeTitle,
|
||||||
return self::sendOut('ORDER_REFUND_SUCCESS', $order['uid'], $data);
|
'amount3' => $order['pay_price'],
|
||||||
|
'character_string6' => $order['order_id']
|
||||||
|
], '/pages/order_details/index?order_id=' . $order['order_id'] . '&isReturen=1');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 订单退款失败
|
||||||
|
* @param $order
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
public static function sendOrderRefundFail($order, $storeTitle)
|
||||||
|
{
|
||||||
|
return self::sendOut('ORDER_REFUND', $order['uid'], [
|
||||||
|
'thing1' => '退款失败',
|
||||||
|
'thing2' => $storeTitle,
|
||||||
|
'amount3' => $order['pay_price'],
|
||||||
|
'character_string6' => $order['order_id']
|
||||||
|
], '/pages/order_details/index?order_id=' . $order['order_id'] . '&isReturen=1');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -79,14 +129,15 @@ class RoutineTemplate
|
|||||||
* @param string $refundReasonWap
|
* @param string $refundReasonWap
|
||||||
* @param array $adminList
|
* @param array $adminList
|
||||||
*/
|
*/
|
||||||
public static function sendOrderRefundStatus($order = array(), $refundReasonWap = '', $adminList = array())
|
public static function sendOrderRefundStatus($order)
|
||||||
{
|
{
|
||||||
$data['keyword1'] = $order['order_id'];
|
$data['character_string4'] = $order['order_id'];
|
||||||
$data['keyword2'] = $refundReasonWap;
|
$data['date5'] = date('Y-m-d H:i:s', time());
|
||||||
$data['keyword3'] = date('Y-m-d H:i:s', time());
|
$data['amount2'] = $order['pay_price'];
|
||||||
$data['keyword4'] = $order['pay_price'];
|
$data['phrase7'] = '申请退款中';
|
||||||
$data['keyword5'] = '原路返回';
|
$data['thing8'] = '请及时处理';
|
||||||
foreach ($adminList as $uid) {
|
$kefuIds = ServiceModel::where('notify', 1)->column('uid', 'uid');
|
||||||
|
foreach ($kefuIds as $uid) {
|
||||||
self::sendOut('ORDER_REFUND_STATUS', $uid, $data);
|
self::sendOut('ORDER_REFUND_STATUS', $uid, $data);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -100,35 +151,122 @@ class RoutineTemplate
|
|||||||
*/
|
*/
|
||||||
public static function sendBargainSuccess($bargain = array(), $bargainUser = array(), $bargainUserId = 0)
|
public static function sendBargainSuccess($bargain = array(), $bargainUser = array(), $bargainUserId = 0)
|
||||||
{
|
{
|
||||||
$data['keyword1'] = $bargain['title'];
|
$data['thing1'] = $bargain['title'];
|
||||||
$data['keyword2'] = $bargainUser['bargain_price'];
|
$data['amount2'] = $bargainUser['min_price'];
|
||||||
$data['keyword3'] = $bargainUser['bargain_price_min'];
|
$data['thing3'] = '恭喜您,已经砍到最低价了';
|
||||||
$data['keyword4'] = $bargainUser['price'];
|
return self::sendOut('BARGAIN_SUCCESS', $bargainUser['uid'], $data, '/pages/activity/user_goods_bargain_list/index');
|
||||||
$data['keyword5'] = $bargainUser['bargain_price_min'];
|
|
||||||
$data['keyword6'] = '恭喜您,已经砍到最低价了';
|
|
||||||
return self::sendOut('BARGAIN_SUCCESS', $bargainUser['uid'], $data);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 订单支付成功发送模板消息
|
* 订单支付成功发送模板消息
|
||||||
* @param string $formId
|
* @param $uid
|
||||||
* @param string $orderId
|
* @param $pay_price
|
||||||
|
* @param $orderId
|
||||||
|
* @param $payTime
|
||||||
* @return bool|void
|
* @return bool|void
|
||||||
* @throws \think\db\exception\DataNotFoundException
|
|
||||||
* @throws \think\db\exception\ModelNotFoundException
|
|
||||||
* @throws \think\exception\DbException
|
|
||||||
*/
|
*/
|
||||||
public static function sendOrderSuccess($formId = '', $orderId = '')
|
public static function sendOrderSuccess($uid, $pay_price, $orderId)
|
||||||
{
|
{
|
||||||
if ($orderId == '') return;
|
if ($orderId == '') return;
|
||||||
$order = StoreOrder::where('order_id', $orderId)->find();
|
$data['character_string1'] = $orderId;
|
||||||
$data['keyword1'] = $orderId;
|
$data['amount2'] = $pay_price . '元';
|
||||||
$data['keyword2'] = date('Y-m-d H:i:s', time());
|
$data['date3'] = date('Y-m-d H:i:s', time());
|
||||||
$data['keyword3'] = '已支付';
|
return self::sendOut('ORDER_PAY_SUCCESS', $uid, $data, '/pages/order_details/index?order_id=' . $orderId);
|
||||||
$data['keyword4'] = $order['pay_price'];
|
}
|
||||||
if ($order['pay_type'] == 'yue') $data['keyword5'] = '余额支付';
|
|
||||||
else if ($order['pay_type'] == 'weixin') $data['keyword5'] = '微信支付';
|
/**
|
||||||
return self::sendOut('ORDER_PAY_SUCCESS', $order['uid'], $data, $formId, '/pages/order_details/index?order_id=' . $orderId);
|
*提现失败
|
||||||
|
* @param $uid
|
||||||
|
* @param $msg
|
||||||
|
* @param $extract_number
|
||||||
|
* @param $extract_type
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
public static function sendExtractFail($uid, $msg, $extract_number, $nickname)
|
||||||
|
{
|
||||||
|
return self::sendOut('USER_EXTRACT', $uid, [
|
||||||
|
'thing1' => '提现失败:' . $msg,
|
||||||
|
'amount2' => $extract_number . '元',
|
||||||
|
'thing3' => $nickname,
|
||||||
|
'date4' => date('Y-m-d H:i:s', time())
|
||||||
|
], '/pages/user_spread_money/index');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 提现成功
|
||||||
|
* @param $uid
|
||||||
|
* @param $extract_number
|
||||||
|
* @param $nickname
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
public static function sendExtractSuccess($uid, $extract_number, $nickname)
|
||||||
|
{
|
||||||
|
return self::sendOut('USER_EXTRACT', $uid, [
|
||||||
|
'thing1' => '提现成功',
|
||||||
|
'amount2' => $extract_number . '元',
|
||||||
|
'thing3' => $nickname,
|
||||||
|
'date4' => date('Y-m-d H:i:s', time())
|
||||||
|
], '/pages/user_spread_money/index');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 拼团成功通知
|
||||||
|
* @param $uid
|
||||||
|
* @param $pinkTitle
|
||||||
|
* @param $nickname
|
||||||
|
* @param $pinkTime
|
||||||
|
* @param $count
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
public static function sendPinkSuccess($uid, $pinkTitle, $nickname, $pinkTime, $count, string $link = '')
|
||||||
|
{
|
||||||
|
return self::sendOut('PINK_TRUE', $uid, [
|
||||||
|
'thing1' => StoreOrder::getSubstrUTf8($pinkTitle, 20,'UTF-8',''),
|
||||||
|
'name3' => $nickname,
|
||||||
|
'date5' => date('Y-m-d H:i:s', $pinkTime),
|
||||||
|
'number2' => $count
|
||||||
|
], $link);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 拼团状态通知
|
||||||
|
* @param $uid
|
||||||
|
* @param $pinkTitle
|
||||||
|
* @param $count
|
||||||
|
* @param $remarks
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
public static function sendPinkFail($uid, $pinkTitle, $count, $remarks, $link)
|
||||||
|
{
|
||||||
|
return self::sendOut('PINK_STATUS', $uid, [
|
||||||
|
'thing2' => StoreOrder::getSubstrUTf8($pinkTitle,20,'UTF-8',''),
|
||||||
|
'thing1' => $count,
|
||||||
|
'thing3' => $remarks
|
||||||
|
], $link);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 赠送积分消息提醒
|
||||||
|
* @param $uid
|
||||||
|
* @param $order
|
||||||
|
* @param $gainIntegral
|
||||||
|
* @param $integral
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
public static function sendUserIntegral($uid, $order, $gainIntegral, $integral)
|
||||||
|
{
|
||||||
|
if (!$order) return false;
|
||||||
|
if (is_string($order['cart_id']))
|
||||||
|
$order['cart_id'] = json_decode($order['cart_id'], true);
|
||||||
|
$storeTitle = StoreOrder::getProductTitle($order['cart_id']);
|
||||||
|
$storeTitle = StoreOrder::getSubstrUTf8($storeTitle, 20);
|
||||||
|
return self::sendOut('INTEGRAL_ACCOUT', $uid, [
|
||||||
|
'character_string2' => $order['order_id'],
|
||||||
|
'thing3' => $storeTitle,
|
||||||
|
'amount4' => $order['pay_price'],
|
||||||
|
'number5' => $gainIntegral,
|
||||||
|
'number6' => $integral
|
||||||
|
], '/pages/user_bill/index?type=2');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -136,26 +274,13 @@ class RoutineTemplate
|
|||||||
* @param string $TempCode 模板消息常量名称
|
* @param string $TempCode 模板消息常量名称
|
||||||
* @param int $uid 用户uid
|
* @param int $uid 用户uid
|
||||||
* @param array $data 模板内容
|
* @param array $data 模板内容
|
||||||
* @param string $formId formId
|
|
||||||
* @param string $link 跳转链接
|
* @param string $link 跳转链接
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
public static function sendOut($TempCode, $uid = null, $data = null, $formId = '', $link = '')
|
public static function sendOut(string $tempCode, $uid, array $data, string $link = '')
|
||||||
{
|
{
|
||||||
try {
|
|
||||||
$openid = WechatUser::uidToOpenid($uid);
|
$openid = WechatUser::uidToOpenid($uid);
|
||||||
if (!$openid) return false;
|
if (!$openid) return false;
|
||||||
if (!$formId) {
|
return Template::instance()->subscribe()->setTemplateUrl($link)->setTemplateOpenId($openid)->setTemplateData($data)->setTemplateCode($tempCode)->send();
|
||||||
$form = RoutineFormId::getFormIdOne($uid, true);
|
|
||||||
if (!$form) return false;
|
|
||||||
if (isset($form['id'])) RoutineFormId::where('id', $form['id'])->delete();
|
|
||||||
} else {
|
|
||||||
$form['form_id'] = $formId;
|
|
||||||
}
|
|
||||||
return Template::instance()->routine()->setTemplateUrl($link)->setTemplateOpenId($openid)
|
|
||||||
->setTemplateData($data)->setTemplateFormId($form['form_id'])->setTemplateCode($TempCode)->send();
|
|
||||||
} catch (\Exception $e) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -74,8 +74,9 @@ class StoreCategory extends BaseModel
|
|||||||
* @throws \think\db\exception\ModelNotFoundException
|
* @throws \think\db\exception\ModelNotFoundException
|
||||||
* @throws \think\exception\DbException
|
* @throws \think\exception\DbException
|
||||||
*/
|
*/
|
||||||
public static function byIndexList($limit = 4, $field = 'id,cate_name,pid,pic')
|
public static function byIndexList($limit = 4,bool $bool = true, $field = 'id,cate_name,pid,pic')
|
||||||
{
|
{
|
||||||
|
if(!$limit && !$bool) return [];
|
||||||
return self::where('pid', '>', 0)->where('is_show', 1)->field($field)->order('sort DESC')->limit($limit)->select();
|
return self::where('pid', '>', 0)->where('is_show', 1)->field($field)->order('sort DESC')->limit($limit)->select();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -52,6 +52,7 @@ class StorePink extends BaseModel
|
|||||||
}
|
}
|
||||||
return $msg;
|
return $msg;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* 获取拼团完成的商品总件数
|
* 获取拼团完成的商品总件数
|
||||||
* */
|
* */
|
||||||
@ -60,12 +61,14 @@ class StorePink extends BaseModel
|
|||||||
|
|
||||||
return self::where('status', 2)->where('is_refund', 0)->sum('total_num');
|
return self::where('status', 2)->where('is_refund', 0)->sum('total_num');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取一条拼团数据
|
* 获取一条拼团数据
|
||||||
* @param $id
|
* @param $id
|
||||||
* @return mixed
|
* @return mixed
|
||||||
*/
|
*/
|
||||||
public static function getPinkUserOne($id){
|
public static function getPinkUserOne($id)
|
||||||
|
{
|
||||||
$model = new self();
|
$model = new self();
|
||||||
$model = $model->alias('p');
|
$model = $model->alias('p');
|
||||||
$model = $model->field('p.*,u.nickname,u.avatar');
|
$model = $model->field('p.*,u.nickname,u.avatar');
|
||||||
@ -79,7 +82,8 @@ class StorePink extends BaseModel
|
|||||||
* @param $id
|
* @param $id
|
||||||
* @return mixed
|
* @return mixed
|
||||||
*/
|
*/
|
||||||
public static function getPinkMember($id){
|
public static function getPinkMember($id)
|
||||||
|
{
|
||||||
$model = new self();
|
$model = new self();
|
||||||
$model = $model->alias('p');
|
$model = $model->alias('p');
|
||||||
$model = $model->field('p.*,u.nickname,u.avatar');
|
$model = $model->field('p.*,u.nickname,u.avatar');
|
||||||
@ -95,7 +99,8 @@ class StorePink extends BaseModel
|
|||||||
* @param $idAll
|
* @param $idAll
|
||||||
* @return $this
|
* @return $this
|
||||||
*/
|
*/
|
||||||
public static function setPinkStopTime($idAll){
|
public static function setPinkStopTime($idAll)
|
||||||
|
{
|
||||||
$model = new self();
|
$model = new self();
|
||||||
$model = $model->where('id', 'IN', $idAll);
|
$model = $model->where('id', 'IN', $idAll);
|
||||||
return $model->update(['stop_time' => time(), 'status' => 2]);
|
return $model->update(['stop_time' => time(), 'status' => 2]);
|
||||||
@ -107,7 +112,8 @@ class StorePink extends BaseModel
|
|||||||
* @param int $isAll 是否查找所有拼团
|
* @param int $isAll 是否查找所有拼团
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
public static function getPinkAll($cid,$isAll=false){
|
public static function getPinkAll($cid, $isAll = false)
|
||||||
|
{
|
||||||
$model = new self();
|
$model = new self();
|
||||||
$model = $model->alias('p');
|
$model = $model->alias('p');
|
||||||
$model = $model->field('p.id,p.uid,p.people,p.price,p.stop_time,u.nickname,u.avatar');
|
$model = $model->field('p.id,p.uid,p.people,p.price,p.stop_time,u.nickname,u.avatar');
|
||||||
@ -137,7 +143,8 @@ class StorePink extends BaseModel
|
|||||||
/**
|
/**
|
||||||
* 获取还差几人
|
* 获取还差几人
|
||||||
*/
|
*/
|
||||||
public static function getPinkPeople($kid,$people){
|
public static function getPinkPeople($kid, $people)
|
||||||
|
{
|
||||||
$model = new self();
|
$model = new self();
|
||||||
$model = $model->where('k_id', $kid)->where('is_refund', 0);
|
$model = $model->where('k_id', $kid)->where('is_refund', 0);
|
||||||
$count = bcadd($model->count(), 1, 0);
|
$count = bcadd($model->count(), 1, 0);
|
||||||
@ -150,7 +157,8 @@ class StorePink extends BaseModel
|
|||||||
* @param $kid
|
* @param $kid
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
public static function getOrderIdAndPink($orderId,$kid){
|
public static function getOrderIdAndPink($orderId, $kid)
|
||||||
|
{
|
||||||
$model = new self();
|
$model = new self();
|
||||||
$pink = $model->where('k_id|id', $kid)->column('order_id');
|
$pink = $model->where('k_id|id', $kid)->column('order_id');
|
||||||
if (in_array($orderId, $pink)) return true;
|
if (in_array($orderId, $pink)) return true;
|
||||||
@ -162,7 +170,8 @@ class StorePink extends BaseModel
|
|||||||
* @param $id
|
* @param $id
|
||||||
* @return int|string
|
* @return int|string
|
||||||
*/
|
*/
|
||||||
public static function getIsPinkUid($id = 0,$uid = 0){
|
public static function getIsPinkUid($id = 0, $uid = 0)
|
||||||
|
{
|
||||||
$pink = self::where('k_id|id', $id)->where('uid', $uid)->where('is_refund', 0)->count();
|
$pink = self::where('k_id|id', $id)->where('uid', $uid)->where('is_refund', 0)->count();
|
||||||
if ($pink) return true;
|
if ($pink) return true;
|
||||||
else return false;
|
else return false;
|
||||||
@ -174,23 +183,27 @@ class StorePink extends BaseModel
|
|||||||
* @param $uidAll
|
* @param $uidAll
|
||||||
* @return int|string
|
* @return int|string
|
||||||
*/
|
*/
|
||||||
public static function isTpl($uidAll,$pid){
|
public static function isTpl($uidAll, $pid)
|
||||||
|
{
|
||||||
if (is_array($uidAll))
|
if (is_array($uidAll))
|
||||||
$count = self::where('uid', 'IN', implode(',', $uidAll))->where('is_tpl', 0)->where('id|k_id', $pid)->count();
|
$count = self::where('uid', 'IN', implode(',', $uidAll))->where('is_tpl', 0)->where('id|k_id', $pid)->count();
|
||||||
else
|
else
|
||||||
$count = self::where('uid', $uidAll)->where('is_tpl', 0)->where('k_id|id', $pid)->count();
|
$count = self::where('uid', $uidAll)->where('is_tpl', 0)->where('k_id|id', $pid)->count();
|
||||||
return $count;
|
return $count;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 拼团成功提示模板消息
|
* 拼团成功提示模板消息
|
||||||
* @param $uidAll
|
* @param $uidAll
|
||||||
* @param $pid
|
* @param $pid
|
||||||
*/
|
*/
|
||||||
public static function orderPinkAfter($uidAll,$pid){
|
public static function orderPinkAfter($uidAll, $pid)
|
||||||
|
{
|
||||||
|
$pinkInfo = self::where('p.id|p.k_id', $pid)->alias('p')->field(['p.people', 't.title', 'p.add_time', 'p.order_id', 'u.nickname'])->join('user u', 'u.uid = p.uid')->join('store_combination t', 'p.cid = t.id')->find();
|
||||||
|
if (!$pinkInfo) return false;
|
||||||
foreach ($uidAll as $key => &$item) {
|
foreach ($uidAll as $key => &$item) {
|
||||||
$openid = WechatUser::uidToOpenid($item, 'openid');
|
$openid = WechatUser::uidToOpenid($item, 'openid');
|
||||||
$routineOpenid = WechatUser::uidToOpenid($item, 'routine_openid');
|
$routineOpenid = WechatUser::uidToOpenid($item, 'routine_openid');
|
||||||
$nickname = WechatUser::uidToOpenid(self::where('id', $pid)->value('uid'), 'nickname');
|
|
||||||
if ($openid) { //公众号模板消息
|
if ($openid) { //公众号模板消息
|
||||||
$firstWeChat = '亲,您的拼团已经完成了';
|
$firstWeChat = '亲,您的拼团已经完成了';
|
||||||
$keyword1WeChat = self::where('id|k_id', $pid)->where('uid', $item)->value('order_id');
|
$keyword1WeChat = self::where('id|k_id', $pid)->where('uid', $item)->value('order_id');
|
||||||
@ -204,12 +217,7 @@ class StorePink extends BaseModel
|
|||||||
'remark' => $remarkWeChat
|
'remark' => $remarkWeChat
|
||||||
], $urlWeChat);
|
], $urlWeChat);
|
||||||
} else if ($routineOpenid) {// 小程序模板消息
|
} else if ($routineOpenid) {// 小程序模板消息
|
||||||
RoutineTemplate::sendOut('PINK_TRUE',$item,[
|
RoutineTemplate::sendPinkSuccess($item, $pinkInfo['title'], $pinkInfo['nickname'] ?? '', $pinkInfo['add_time'], $pinkInfo['people'], '/pages/order_details/index?order_id=' . $pinkInfo['order_id']);
|
||||||
'keyword1'=>'亲,您的拼团已经完成了',
|
|
||||||
'keyword2'=>$nickname,
|
|
||||||
'keyword3'=>date('Y-m-d H:i:s',time()),
|
|
||||||
'keyword4'=>self::where('id',$pid)->value('price')
|
|
||||||
]);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
self::beginTrans();
|
self::beginTrans();
|
||||||
@ -222,7 +230,8 @@ class StorePink extends BaseModel
|
|||||||
* @param $uid
|
* @param $uid
|
||||||
* @param $pid
|
* @param $pid
|
||||||
*/
|
*/
|
||||||
public static function orderPinkAfterNo($uid,$pid,$formId='',$fillTilt='',$isRemove=false){
|
public static function orderPinkAfterNo($uid, $pid, $formId = '', $fillTilt = '', $isRemove = false)
|
||||||
|
{
|
||||||
$store = self::alias('p')->where('p.id|p.k_id', $pid)->field('c.*')->where('p.uid', $uid)->join('store_combination c', 'c.id=p.cid')->find();
|
$store = self::alias('p')->where('p.id|p.k_id', $pid)->field('c.*')->where('p.uid', $uid)->join('store_combination c', 'c.id=p.cid')->find();
|
||||||
$pink = self::where('id|k_id', $pid)->where('uid', $uid)->find();
|
$pink = self::where('id|k_id', $pid)->where('uid', $uid)->find();
|
||||||
$openid = WechatUser::uidToOpenid($uid, 'openid');
|
$openid = WechatUser::uidToOpenid($uid, 'openid');
|
||||||
@ -238,11 +247,7 @@ class StorePink extends BaseModel
|
|||||||
'remark' => '点击查看订单详情'
|
'remark' => '点击查看订单详情'
|
||||||
], $urlWeChat);
|
], $urlWeChat);
|
||||||
} else if ($routineOpenid) {//小程序发送模板消息
|
} else if ($routineOpenid) {//小程序发送模板消息
|
||||||
RoutineTemplate::sendOut('PINK_REMOVE',$uid,[
|
RoutineTemplate::sendPinkFail($uid, $store->title, $pink->people, '亲,您的拼团取消,点击查看订单详情', '/pages/order_details/index?order_id=' . $pink->order_id);
|
||||||
'keyword1'=>$store->title,
|
|
||||||
'keyword2'=>$pink->order_id,
|
|
||||||
'keyword3'=>$pink->price,
|
|
||||||
],$formId,'/pages/order_details/index?order_id='.$pink->order_id);
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if ($openid) {//公众号发送模板消息
|
if ($openid) {//公众号发送模板消息
|
||||||
@ -255,13 +260,13 @@ class StorePink extends BaseModel
|
|||||||
'remark' => '点击查看订单详情'
|
'remark' => '点击查看订单详情'
|
||||||
], $urlWeChat);
|
], $urlWeChat);
|
||||||
} else if ($routineOpenid) {//小程序发送模板消息
|
} else if ($routineOpenid) {//小程序发送模板消息
|
||||||
RoutineTemplate::sendOut('PINK_Fill',$uid,[
|
RoutineTemplate::sendPinkFail(
|
||||||
'keyword1'=>$store->title,
|
$uid,
|
||||||
'keyword2'=>$fillTilt,
|
$store->title,
|
||||||
'keyword3'=>$pink->order_id,
|
$pink->people,
|
||||||
'keyword4'=>date('Y-m-d H:i:s',$pink->add_time),
|
'亲,您拼团失败,自动为您申请退款,退款金额为:' . $pink->price,
|
||||||
'keyword5'=>'申请退款金额:¥'.$pink->price,
|
'/pages/order_details/index?order_id=' . $pink->order_id
|
||||||
],$formId,'/pages/order_details/index?order_id='.$pink->order_id);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
self::where('id', $pid)->update(['status' => 3, 'stop_time' => time()]);
|
self::where('id', $pid)->update(['status' => 3, 'stop_time' => time()]);
|
||||||
@ -273,13 +278,15 @@ class StorePink extends BaseModel
|
|||||||
* @param $id
|
* @param $id
|
||||||
* @return array|false|\PDOStatement|string|\think\Model
|
* @return array|false|\PDOStatement|string|\think\Model
|
||||||
*/
|
*/
|
||||||
public static function getCurrentPink($id,$uid){
|
public static function getCurrentPink($id, $uid)
|
||||||
|
{
|
||||||
$pink = self::where('id', $id)->where('uid', $uid)->find();
|
$pink = self::where('id', $id)->where('uid', $uid)->find();
|
||||||
if (!$pink) $pink = self::where('k_id', $id)->where('uid', $uid)->find();
|
if (!$pink) $pink = self::where('k_id', $id)->where('uid', $uid)->find();
|
||||||
return StoreOrder::where('id', $pink['order_id_key'])->value('order_id');
|
return StoreOrder::where('id', $pink['order_id_key'])->value('order_id');
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function systemPage($where){
|
public static function systemPage($where)
|
||||||
|
{
|
||||||
$model = new self;
|
$model = new self;
|
||||||
$model = $model->alias('p');
|
$model = $model->alias('p');
|
||||||
$model = $model->field('p.*,c.title');
|
$model = $model->field('p.*,c.title');
|
||||||
@ -297,7 +304,8 @@ class StorePink extends BaseModel
|
|||||||
}, $where);
|
}, $where);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function isPinkBe($data,$id){
|
public static function isPinkBe($data, $id)
|
||||||
|
{
|
||||||
$data['id'] = $id;
|
$data['id'] = $id;
|
||||||
$count = self::where($data)->count();
|
$count = self::where($data)->count();
|
||||||
if ($count) return $count;
|
if ($count) return $count;
|
||||||
@ -306,7 +314,9 @@ class StorePink extends BaseModel
|
|||||||
if ($count) return $count;
|
if ($count) return $count;
|
||||||
else return 0;
|
else return 0;
|
||||||
}
|
}
|
||||||
public static function isPinkStatus($pinkId){
|
|
||||||
|
public static function isPinkStatus($pinkId)
|
||||||
|
{
|
||||||
if (!$pinkId) return false;
|
if (!$pinkId) return false;
|
||||||
$stopTime = self::where('id', $pinkId)->value('stop_time');
|
$stopTime = self::where('id', $pinkId)->value('stop_time');
|
||||||
if ($stopTime < time()) return true; //拼团结束
|
if ($stopTime < time()) return true; //拼团结束
|
||||||
@ -318,7 +328,8 @@ class StorePink extends BaseModel
|
|||||||
* @param $pinkId
|
* @param $pinkId
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
public static function isSetPinkOver($pinkId){
|
public static function isSetPinkOver($pinkId)
|
||||||
|
{
|
||||||
$people = self::where('id', $pinkId)->value('people');
|
$people = self::where('id', $pinkId)->value('people');
|
||||||
$stopTime = self::where('id', $pinkId)->value('stop_time');
|
$stopTime = self::where('id', $pinkId)->value('stop_time');
|
||||||
if ($stopTime < time()) {
|
if ($stopTime < time()) {
|
||||||
@ -333,7 +344,8 @@ class StorePink extends BaseModel
|
|||||||
* @param $id
|
* @param $id
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
public static function setRefundPink($oid){
|
public static function setRefundPink($oid)
|
||||||
|
{
|
||||||
$res = true;
|
$res = true;
|
||||||
$order = StoreOrder::where('id', $oid)->find();
|
$order = StoreOrder::where('id', $oid)->find();
|
||||||
if ($order['pink_id']) $id = $order['pink_id'];
|
if ($order['pink_id']) $id = $order['pink_id'];
|
||||||
@ -363,13 +375,13 @@ class StorePink extends BaseModel
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 拼团人数完成时,判断全部人都是未退款状态
|
* 拼团人数完成时,判断全部人都是未退款状态
|
||||||
* @param $pinkIds
|
* @param $pinkIds
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
public static function setPinkStatus($pinkIds){
|
public static function setPinkStatus($pinkIds)
|
||||||
|
{
|
||||||
$orderPink = self::where('id', 'IN', $pinkIds)->where('is_refund', 1)->count();
|
$orderPink = self::where('id', 'IN', $pinkIds)->where('is_refund', 1)->count();
|
||||||
if (!$orderPink) return true;
|
if (!$orderPink) return true;
|
||||||
else return false;
|
else return false;
|
||||||
@ -381,7 +393,8 @@ class StorePink extends BaseModel
|
|||||||
* @param $order
|
* @param $order
|
||||||
* @return mixed
|
* @return mixed
|
||||||
*/
|
*/
|
||||||
public static function createPink($order){
|
public static function createPink($order)
|
||||||
|
{
|
||||||
$order = StoreOrder::tidyOrder($order, true)->toArray();
|
$order = StoreOrder::tidyOrder($order, true)->toArray();
|
||||||
$openid = WechatUser::uidToOpenid($order['uid'], 'openid');
|
$openid = WechatUser::uidToOpenid($order['uid'], 'openid');
|
||||||
$routineOpenid = WechatUser::uidToOpenid($order['uid'], 'routine_openid');
|
$routineOpenid = WechatUser::uidToOpenid($order['uid'], 'routine_openid');
|
||||||
@ -414,12 +427,14 @@ class StorePink extends BaseModel
|
|||||||
'remark' => '点击查看订单详情'
|
'remark' => '点击查看订单详情'
|
||||||
], $urlWeChat);
|
], $urlWeChat);
|
||||||
} else if ($routineOpenid) {
|
} else if ($routineOpenid) {
|
||||||
RoutineTemplate::sendOut('PINK_TRUE',$order['uid'],[
|
$nickname = User::where('uid', self::where('id', $pink['k_id'])->value('uid'))->value('nickname');
|
||||||
'keyword1'=>$product->title,
|
RoutineTemplate::sendPinkSuccess(
|
||||||
'keyword2'=>User::where('uid',self::where('id',$pink['k_id'])->value('uid'))->value('nickname'),
|
$order['uid'], $product->title,
|
||||||
'keyword3'=>date('Y-m-d H:i:s',$pink['add_time']),
|
$nickname,
|
||||||
'keyword3'=>$pink['total_price'],
|
$pink['add_time'],
|
||||||
],'','/pages/order_details/index?order_id='.$pink['order_id']);
|
$pink['people'],
|
||||||
|
'/pages/order_details/index?order_id=' . $pink['order_id']
|
||||||
|
);
|
||||||
}
|
}
|
||||||
//处理拼团完成
|
//处理拼团完成
|
||||||
list($pinkAll, $pinkT, $count, $idAll, $uidAll) = self::getPinkMemberAndPinkK($pink);
|
list($pinkAll, $pinkT, $count, $idAll, $uidAll) = self::getPinkMemberAndPinkK($pink);
|
||||||
@ -461,13 +476,14 @@ class StorePink extends BaseModel
|
|||||||
'remark' => '点击查看订单详情'
|
'remark' => '点击查看订单详情'
|
||||||
], $urlWeChat);
|
], $urlWeChat);
|
||||||
} else if ($routineOpenid && $order['is_channel'] == 1) {
|
} else if ($routineOpenid && $order['is_channel'] == 1) {
|
||||||
RoutineTemplate::sendOut('OPEN_PINK_SUCCESS',$order['uid'],[
|
$nickname = User::where('uid', $order['uid'])->value('nickname');
|
||||||
'keyword1'=>date('Y-m-d H:i:s',$pink['add_time']),
|
RoutineTemplate::sendPinkSuccess(
|
||||||
'keyword2'=>date('Y-m-d H:i:s',$pink['stop_time']),
|
$order['uid'], $product->title,
|
||||||
'keyword3'=>$product->title,
|
$nickname,
|
||||||
'keyword4'=>$pink['order_id'],
|
$pink['add_time'],
|
||||||
'keyword4'=>$pink['total_price'],
|
$pink['people'],
|
||||||
],'','/pages/order_details/index?order_id='.$pink['order_id']);
|
'/pages/order_details/index?order_id=' . $pink['order_id']
|
||||||
|
);
|
||||||
}
|
}
|
||||||
if ($res) return true;
|
if ($res) return true;
|
||||||
else return false;
|
else return false;
|
||||||
@ -476,6 +492,7 @@ class StorePink extends BaseModel
|
|||||||
Log::error('拼团支付成功读取产品数据失败订单号:' . $order['order_id']);
|
Log::error('拼团支付成功读取产品数据失败订单号:' . $order['order_id']);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* 获取一条今天正在拼团的人的头像和名称
|
* 获取一条今天正在拼团的人的头像和名称
|
||||||
* */
|
* */
|
||||||
@ -494,7 +511,7 @@ class StorePink extends BaseModel
|
|||||||
// $pinkRakeBack = self::where('id',$id)->field('people,price,uid,id')->find()->toArray();
|
// $pinkRakeBack = self::where('id',$id)->field('people,price,uid,id')->find()->toArray();
|
||||||
// $countPrice = bcmul($pinkRakeBack['people'],$pinkRakeBack['price'],2);
|
// $countPrice = bcmul($pinkRakeBack['people'],$pinkRakeBack['price'],2);
|
||||||
// if(bcsub((float)$countPrice,0,2) <= 0) return true;
|
// if(bcsub((float)$countPrice,0,2) <= 0) return true;
|
||||||
// $rakeBack = (sysConfig('rake_back_colonel') ?: 0)/100;
|
// $rakeBack = (sys_config('rake_back_colonel') ?: 0)/100;
|
||||||
// if($rakeBack <= 0) return true;
|
// if($rakeBack <= 0) return true;
|
||||||
// $rakeBackPrice = bcmul($countPrice,$rakeBack,2);
|
// $rakeBackPrice = bcmul($countPrice,$rakeBack,2);
|
||||||
// if($rakeBackPrice <= 0) return true;
|
// if($rakeBackPrice <= 0) return true;
|
||||||
@ -541,7 +558,8 @@ class StorePink extends BaseModel
|
|||||||
* @param boolen $isIds 是否返回记录所有拼团id
|
* @param boolen $isIds 是否返回记录所有拼团id
|
||||||
* @return int| boolen
|
* @return int| boolen
|
||||||
* */
|
* */
|
||||||
public static function PinkFail($pinkAll,$pinkT,$pinkBool,$isRunErr=true,$isIds=false){
|
public static function PinkFail($pinkAll, $pinkT, $pinkBool, $isRunErr = true, $isIds = false)
|
||||||
|
{
|
||||||
self::startTrans();
|
self::startTrans();
|
||||||
$pinkIds = [];
|
$pinkIds = [];
|
||||||
try {
|
try {
|
||||||
@ -571,7 +589,8 @@ class StorePink extends BaseModel
|
|||||||
* @param array $pink
|
* @param array $pink
|
||||||
* @return array
|
* @return array
|
||||||
* */
|
* */
|
||||||
public static function getPinkMemberAndPinkK($pink){
|
public static function getPinkMemberAndPinkK($pink)
|
||||||
|
{
|
||||||
//查找拼团团员和团长
|
//查找拼团团员和团长
|
||||||
if ($pink['k_id']) {
|
if ($pink['k_id']) {
|
||||||
$pinkAll = self::getPinkMember($pink['k_id']);
|
$pinkAll = self::getPinkMember($pink['k_id']);
|
||||||
@ -595,6 +614,7 @@ class StorePink extends BaseModel
|
|||||||
$uidAll[] = $pinkT['uid'];
|
$uidAll[] = $pinkT['uid'];
|
||||||
return [$pinkAll, $pinkT, $count, $idAll, $uidAll];
|
return [$pinkAll, $pinkT, $count, $idAll, $uidAll];
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* 取消开团
|
* 取消开团
|
||||||
* @param int $uid 用户id
|
* @param int $uid 用户id
|
||||||
@ -731,13 +751,13 @@ class StorePink extends BaseModel
|
|||||||
], $urlWeChat);
|
], $urlWeChat);
|
||||||
} else if ($routineOpenid) {
|
} else if ($routineOpenid) {
|
||||||
//小程序模板消息
|
//小程序模板消息
|
||||||
RoutineTemplate::sendOut('PINK_Fill',$item,[
|
RoutineTemplate::sendPinkFail(
|
||||||
'keyword1'=>$store->title,
|
$item,
|
||||||
'keyword2'=>'拼团取消开团',
|
$store->title,
|
||||||
'keyword3'=>$pink->order_id,
|
$pink->people,
|
||||||
'keyword4'=>date('Y-m-d H:i:s',$pink->add_time),
|
'亲,您拼团失败,自动为您申请退款,退款金额为:' . $pink->price,
|
||||||
'keyword5'=>'申请退款金额:¥'.$pink->price,
|
'/pages/order_details/index?order_id=' . $pink->order_id
|
||||||
],'','/pages/order_details/index?order_id='.$pink->order_id);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
self::where('uid', 'IN', implode(',', $pinkUidList))->where('id|k_id', $pink)->update(['is_tpl' => 1]);
|
self::where('uid', 'IN', implode(',', $pinkUidList))->where('id|k_id', $pink)->update(['is_tpl' => 1]);
|
||||||
@ -762,7 +782,8 @@ class StorePink extends BaseModel
|
|||||||
* @param $pinkList
|
* @param $pinkList
|
||||||
* @return StorePink
|
* @return StorePink
|
||||||
*/
|
*/
|
||||||
public static function pinkStopStatus($pinkList){
|
public static function pinkStopStatus($pinkList)
|
||||||
|
{
|
||||||
return self::where('id', 'IN', $pinkList)->update(['status' => 3]);
|
return self::where('id', 'IN', $pinkList)->update(['status' => 3]);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -803,13 +824,16 @@ class StorePink extends BaseModel
|
|||||||
], $urlWeChat);
|
], $urlWeChat);
|
||||||
} else if ($routineOpenid) {
|
} else if ($routineOpenid) {
|
||||||
//小程序模板消息
|
//小程序模板消息
|
||||||
$keyword4Routine = self::where('id|k_id',$pink)->where('uid',$item)->value('price');
|
$pinkInfo = self::where('k.id|k.k_id', $pink)->alias('k')->where('k.uid', $item)
|
||||||
RoutineTemplate::sendOut('PINK_TRUE',$item,[
|
->field(['k.order_id', 'k.people', 'k.add_time', 'c.title'])
|
||||||
'keyword1'=>'亲,您的拼团已经完成了',
|
->join('store_combination c', 'c.id = k.cid')->find();
|
||||||
'keyword2'=>$nickname,
|
RoutineTemplate::sendPinkSuccess(
|
||||||
'keyword3'=>date('Y-m-d H:i:s',time()),
|
$item, $pinkInfo['title'] ?? '',
|
||||||
'keyword4'=>$keyword4Routine
|
$nickname,
|
||||||
]);
|
$pinkInfo['add_time'] ?? 0,
|
||||||
|
$pinkInfo['people'] ?? 0,
|
||||||
|
'/pages/order_details/index?order_id=' . $pinkInfo['order_id'] ?? ''
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
self::where('uid', 'IN', implode(',', $pinkUidList))->where('id|k_id', $pink)->update(['is_tpl' => 1]);
|
self::where('uid', 'IN', implode(',', $pinkUidList))->where('id|k_id', $pink)->update(['is_tpl' => 1]);
|
||||||
|
|||||||
@ -154,8 +154,9 @@ class StoreProduct extends BaseModel
|
|||||||
* @param int $limit
|
* @param int $limit
|
||||||
* @return false|\PDOStatement|string|\think\Collection
|
* @return false|\PDOStatement|string|\think\Collection
|
||||||
*/
|
*/
|
||||||
public static function getNewProduct($field = '*', $limit = 0, $uid = 0)
|
public static function getNewProduct($field = '*', $limit = 0, $uid = 0, bool $bool = true)
|
||||||
{
|
{
|
||||||
|
if (!$limit && !$bool) return [];
|
||||||
$model = self::where('is_new', 1)->where('is_del', 0)->where('mer_id', 0)
|
$model = self::where('is_new', 1)->where('is_del', 0)->where('mer_id', 0)
|
||||||
->where('stock', '>', 0)->where('is_show', 1)->field($field)
|
->where('stock', '>', 0)->where('is_show', 1)->field($field)
|
||||||
->order('sort DESC, id DESC');
|
->order('sort DESC, id DESC');
|
||||||
@ -208,8 +209,9 @@ class StoreProduct extends BaseModel
|
|||||||
* @param int $limit
|
* @param int $limit
|
||||||
* @return false|\PDOStatement|string|\think\Collection
|
* @return false|\PDOStatement|string|\think\Collection
|
||||||
*/
|
*/
|
||||||
public static function getBestProduct($field = '*', $limit = 0, $uid = 0)
|
public static function getBestProduct($field = '*', $limit = 0, $uid = 0, bool $bool = true)
|
||||||
{
|
{
|
||||||
|
if (!$limit && !$bool) return [];
|
||||||
$model = self::where('is_best', 1)->where('is_del', 0)->where('mer_id', 0)
|
$model = self::where('is_best', 1)->where('is_del', 0)->where('mer_id', 0)
|
||||||
->where('stock', '>', 0)->where('is_show', 1)->field($field)
|
->where('stock', '>', 0)->where('is_show', 1)->field($field)
|
||||||
->order('sort DESC, id DESC');
|
->order('sort DESC, id DESC');
|
||||||
@ -217,7 +219,7 @@ class StoreProduct extends BaseModel
|
|||||||
return self::setLevelPrice($model->select(), $uid);
|
return self::setLevelPrice($model->select(), $uid);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/**
|
||||||
* 设置会员价格
|
* 设置会员价格
|
||||||
* @param object | array $list 产品列表
|
* @param object | array $list 产品列表
|
||||||
* @param int $uid 用户uid
|
* @param int $uid 用户uid
|
||||||
@ -226,7 +228,7 @@ class StoreProduct extends BaseModel
|
|||||||
public static function setLevelPrice($list, $uid, $isSingle = false)
|
public static function setLevelPrice($list, $uid, $isSingle = false)
|
||||||
{
|
{
|
||||||
if (is_object($list)) $list = count($list) ? $list->toArray() : [];
|
if (is_object($list)) $list = count($list) ? $list->toArray() : [];
|
||||||
if (!sysConfig('vip_open')) {
|
if (!sys_config('vip_open')) {
|
||||||
if (is_array($list)) return $list;
|
if (is_array($list)) return $list;
|
||||||
return $isSingle ? $list : 0;
|
return $isSingle ? $list : 0;
|
||||||
}
|
}
|
||||||
@ -316,11 +318,12 @@ class StoreProduct extends BaseModel
|
|||||||
}
|
}
|
||||||
if ($res) {
|
if ($res) {
|
||||||
$stock = self::where('id', $productId)->value('stock');
|
$stock = self::where('id', $productId)->value('stock');
|
||||||
$replenishment_num = sysConfig('store_stock') ?? 0;//库存预警界限
|
$replenishment_num = sys_config('store_stock') ?? 0;//库存预警界限
|
||||||
if ($replenishment_num >= $stock) {
|
if ($replenishment_num >= $stock) {
|
||||||
try {
|
try {
|
||||||
ChannelService::instance()->send('STORE_STOCK', ['id' => $productId]);
|
ChannelService::instance()->send('STORE_STOCK', ['id' => $productId]);
|
||||||
}catch (\Exception $e){}
|
} catch (\Exception $e) {
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return $res;
|
return $res;
|
||||||
@ -359,7 +362,7 @@ class StoreProduct extends BaseModel
|
|||||||
*/
|
*/
|
||||||
public static function getPacketPrice($storeInfo, $productValue)
|
public static function getPacketPrice($storeInfo, $productValue)
|
||||||
{
|
{
|
||||||
$store_brokerage_ratio = sysConfig('store_brokerage_ratio');
|
$store_brokerage_ratio = sys_config('store_brokerage_ratio');
|
||||||
$store_brokerage_ratio = bcdiv($store_brokerage_ratio, 100, 2);
|
$store_brokerage_ratio = bcdiv($store_brokerage_ratio, 100, 2);
|
||||||
if (count($productValue)) {
|
if (count($productValue)) {
|
||||||
$Maxkey = self::getArrayMax($productValue, 'price');
|
$Maxkey = self::getArrayMax($productValue, 'price');
|
||||||
@ -452,7 +455,8 @@ class StoreProduct extends BaseModel
|
|||||||
* @param string $field
|
* @param string $field
|
||||||
* @return mixed
|
* @return mixed
|
||||||
*/
|
*/
|
||||||
public static function getProductField($id,$field = 'store_name'){
|
public static function getProductField($id, $field = 'store_name')
|
||||||
|
{
|
||||||
if (is_array($id))
|
if (is_array($id))
|
||||||
return self::where('id', 'in', $id)->field($field)->select();
|
return self::where('id', 'in', $id)->field($field)->select();
|
||||||
else
|
else
|
||||||
|
|||||||
@ -37,6 +37,7 @@ class SystemStore extends BaseModel
|
|||||||
{
|
{
|
||||||
return self::where('is_show', 1)->where('is_del', 0);
|
return self::where('is_show', 1)->where('is_del', 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* 获取门店信息
|
* 获取门店信息
|
||||||
* @param int $id
|
* @param int $id
|
||||||
@ -50,7 +51,7 @@ class SystemStore extends BaseModel
|
|||||||
if ($storeInfo) {
|
if ($storeInfo) {
|
||||||
$storeInfo['latlng'] = self::getLatlngAttr(null, $storeInfo);
|
$storeInfo['latlng'] = self::getLatlngAttr(null, $storeInfo);
|
||||||
$storeInfo['valid_time'] = $storeInfo['valid_time'] ? explode(' - ', $storeInfo['valid_time']) : [];
|
$storeInfo['valid_time'] = $storeInfo['valid_time'] ? explode(' - ', $storeInfo['valid_time']) : [];
|
||||||
$storeInfo['_valid_time'] = str_replace('-','/',($storeInfo['valid_time'][0] ?? '').' ~ '.($storeInfo['valid_time'][1]) ?? '');
|
$storeInfo['_valid_time'] = str_replace('-', '/', ($storeInfo['valid_time'][0] ?? '') . ' ~ ' . ($storeInfo['valid_time'][1] ?? ""));
|
||||||
$storeInfo['day_time'] = $storeInfo['day_time'] ? str_replace(' - ', ' ~ ', $storeInfo['day_time']) : [];
|
$storeInfo['day_time'] = $storeInfo['day_time'] ? str_replace(' - ', ' ~ ', $storeInfo['day_time']) : [];
|
||||||
$storeInfo['_detailed_address'] = $storeInfo['address'] . ' ' . $storeInfo['detailed_address'];
|
$storeInfo['_detailed_address'] = $storeInfo['address'] . ' ' . $storeInfo['detailed_address'];
|
||||||
$storeInfo['address'] = $storeInfo['address'] ? explode(',', $storeInfo['address']) : [];
|
$storeInfo['address'] = $storeInfo['address'] ? explode(',', $storeInfo['address']) : [];
|
||||||
|
|||||||
@ -15,6 +15,7 @@ use app\models\routine\RoutineTemplate;
|
|||||||
use app\models\store\StoreOrderCartInfo;
|
use app\models\store\StoreOrderCartInfo;
|
||||||
use app\models\user\User;
|
use app\models\user\User;
|
||||||
use crmeb\services\YLYService;
|
use crmeb\services\YLYService;
|
||||||
|
use think\facade\Log;
|
||||||
use think\facade\Route;
|
use think\facade\Route;
|
||||||
|
|
||||||
/** 消息通知静态类
|
/** 消息通知静态类
|
||||||
@ -52,7 +53,7 @@ class NoticeRepositories
|
|||||||
//订单支付成功后给客服发送客服消息
|
//订单支付成功后给客服发送客服消息
|
||||||
CustomerRepository::sendOrderPaySuccessCustomerService($order, 1);
|
CustomerRepository::sendOrderPaySuccessCustomerService($order, 1);
|
||||||
} else if ($routineOpenid && in_array($order['is_channel'],[1,2])) {//小程序发送模板消息
|
} else if ($routineOpenid && in_array($order['is_channel'],[1,2])) {//小程序发送模板消息
|
||||||
RoutineTemplate::sendOrderSuccess($formId, $order['order_id']);
|
RoutineTemplate::sendOrderSuccess($order['uid'],$order['pay_price'], $order['order_id']);
|
||||||
//订单支付成功后给客服发送客服消息
|
//订单支付成功后给客服发送客服消息
|
||||||
CustomerRepository::sendOrderPaySuccessCustomerService($order, 0);
|
CustomerRepository::sendOrderPaySuccessCustomerService($order, 0);
|
||||||
}
|
}
|
||||||
@ -61,7 +62,7 @@ class NoticeRepositories
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
//打印小票
|
//打印小票
|
||||||
$switch = sysConfig('pay_success_printing_switch') ? true : false;
|
$switch = sys_config('pay_success_printing_switch') ? true : false;
|
||||||
if ($switch) {
|
if ($switch) {
|
||||||
try {
|
try {
|
||||||
$order['cart_id'] = is_string($order['cart_id']) ? json_decode($order['cart_id'], true) : $order['cart_id'];
|
$order['cart_id'] = is_string($order['cart_id']) ? json_decode($order['cart_id'], true) : $order['cart_id'];
|
||||||
@ -74,7 +75,7 @@ class NoticeRepositories
|
|||||||
$value['productInfo']['store_name'] = StoreOrderCartInfo::getSubstrUTf8($value['productInfo']['store_name'], 10, 'UTF-8', '');
|
$value['productInfo']['store_name'] = StoreOrderCartInfo::getSubstrUTf8($value['productInfo']['store_name'], 10, 'UTF-8', '');
|
||||||
$product[] = $value;
|
$product[] = $value;
|
||||||
}
|
}
|
||||||
YLYService::instance()->setContent(sysConfig('site_name'), is_object($order) ? $order->toArray() : $order, $product)->orderPrinting();
|
YLYService::instance()->setContent(sys_config('site_name'), is_object($order) ? $order->toArray() : $order, $product)->orderPrinting();
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
Log::error('小票打印出现错误,错误原因:' . $e->getMessage());
|
Log::error('小票打印出现错误,错误原因:' . $e->getMessage());
|
||||||
}
|
}
|
||||||
|
|||||||
@ -44,9 +44,13 @@ class CacheService
|
|||||||
* @param bool $default
|
* @param bool $default
|
||||||
* @return mixed
|
* @return mixed
|
||||||
*/
|
*/
|
||||||
public static function get(string $name, $default = false)
|
public static function get(string $name, $default = false, int $expire = null)
|
||||||
{
|
{
|
||||||
return self::handler()->remember($name, $default);
|
//这里不要去读取缓存配置,会导致死循环
|
||||||
|
$expire = $expire ?: SystemConfigService::get('cache_config', null, true);
|
||||||
|
if (!is_int($expire))
|
||||||
|
$expire = (int)$expire;
|
||||||
|
return self::handler()->remember($name, $default, $expire);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -39,7 +39,7 @@ class MiniProgramService
|
|||||||
'key' => trim($payment['pay_routine_key']),
|
'key' => trim($payment['pay_routine_key']),
|
||||||
'cert_path' => realpath('.' . $payment['pay_routine_client_cert']),
|
'cert_path' => realpath('.' . $payment['pay_routine_client_cert']),
|
||||||
'key_path' => realpath('.' . $payment['pay_routine_client_key']),
|
'key_path' => realpath('.' . $payment['pay_routine_client_key']),
|
||||||
'notify_url' => $wechat['site_url'] . Url::buildUrl('/api/routine/notify')
|
'notify_url' => $wechat['site_url'] . Url::buildUrl('/api/routine/notify')->suffix(false)->build()
|
||||||
];
|
];
|
||||||
return $config;
|
return $config;
|
||||||
}
|
}
|
||||||
@ -133,6 +133,15 @@ class MiniProgramService
|
|||||||
return self::miniprogram()->notice;
|
return self::miniprogram()->notice;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 订阅模板消息接口
|
||||||
|
* @return \crmeb\utils\ProgramSubscribe
|
||||||
|
*/
|
||||||
|
public static function SubscribenoticeService()
|
||||||
|
{
|
||||||
|
return self::miniprogram()->now_notice;
|
||||||
|
}
|
||||||
|
|
||||||
/**发送小程序模版消息
|
/**发送小程序模版消息
|
||||||
* @param $openid
|
* @param $openid
|
||||||
* @param $templateId
|
* @param $templateId
|
||||||
@ -150,6 +159,21 @@ class MiniProgramService
|
|||||||
return $notice->send($message);
|
return $notice->send($message);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 发送订阅消息
|
||||||
|
* @param string $touser 接收者(用户)的 openid
|
||||||
|
* @param string $templateId 所需下发的订阅模板id
|
||||||
|
* @param array $data 模板内容,格式形如 { "key1": { "value": any }, "key2": { "value": any } }
|
||||||
|
* @param string $link 击模板卡片后的跳转页面,仅限本小程序内的页面。支持带参数,(示例index?foo=bar)。该字段不填则模板无跳转。
|
||||||
|
* @return \EasyWeChat\Support\Collection|null
|
||||||
|
* @throws \EasyWeChat\Core\Exceptions\HttpException
|
||||||
|
* @throws \EasyWeChat\Core\Exceptions\InvalidArgumentException
|
||||||
|
*/
|
||||||
|
public static function sendSubscribeTemlate(string $touser,string $templateId,array $data,string $link = '')
|
||||||
|
{
|
||||||
|
return self::SubscribenoticeService()->to($touser)->template($templateId)->andData($data)->withUrl($link)->send();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 支付
|
* 支付
|
||||||
|
|||||||
206
crmeb/crmeb/services/SubscribeTemplateService.php
Normal file
206
crmeb/crmeb/services/SubscribeTemplateService.php
Normal file
@ -0,0 +1,206 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace crmeb\services;
|
||||||
|
|
||||||
|
use app\admin\model\wechat\WechatUser;
|
||||||
|
use app\admin\model\wechat\StoreService as ServiceModel;
|
||||||
|
use app\models\routine\RoutineTemplate;
|
||||||
|
use crmeb\interfaces\ProviderInterface;
|
||||||
|
use think\facade\Db;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 小程序模板消息
|
||||||
|
* Class RoutineTemplate
|
||||||
|
* @package app\routine\model\routine
|
||||||
|
*/
|
||||||
|
class SubscribeTemplateService implements ProviderInterface
|
||||||
|
{
|
||||||
|
|
||||||
|
//订单发货提醒(送货)
|
||||||
|
const ORDER_POSTAGE_SUCCESS = 1128;
|
||||||
|
//提现成功通知
|
||||||
|
const USER_EXTRACT = 1470;
|
||||||
|
//确认收货通知
|
||||||
|
const OREDER_TAKEVER = 1481;
|
||||||
|
//订单取消
|
||||||
|
const ORDER_CLONE = 1134;
|
||||||
|
//订单发货提醒(快递)
|
||||||
|
const ORDER_DELIVER_SUCCESS = 1458;
|
||||||
|
//拼团成功
|
||||||
|
const PINK_TRUE = 3098;
|
||||||
|
//砍价成功
|
||||||
|
const BARGAIN_SUCCESS = 2727;
|
||||||
|
//核销成功通知
|
||||||
|
const ORDER_WRITE_OFF = 3116;
|
||||||
|
//新订单提醒
|
||||||
|
const ORDER_NEW = 1476;
|
||||||
|
//退款通知
|
||||||
|
const ORDER_REFUND = 1451;
|
||||||
|
//充值成功
|
||||||
|
const RECHARGE_SUCCESS = 755;
|
||||||
|
//订单支付成功
|
||||||
|
const ORDER_PAY_SUCCESS = 1927;
|
||||||
|
//申请退款通知 管理员提醒
|
||||||
|
const ORDER_REFUND_STATUS = 1468;
|
||||||
|
//积分到账提醒
|
||||||
|
const INTEGRAL_ACCOUT = 335;
|
||||||
|
//拼团状态通知
|
||||||
|
const PINK_STATUS = 3353;
|
||||||
|
|
||||||
|
public static function getConstants($code = '')
|
||||||
|
{
|
||||||
|
$oClass = new \ReflectionClass(__CLASS__);
|
||||||
|
$stants = $oClass->getConstants();
|
||||||
|
if ($code) return isset($stants[$code]) ? $stants[$code] : '';
|
||||||
|
else return $stants;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function register($config)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据模板编号获取模板ID
|
||||||
|
* @param string $tempKey
|
||||||
|
* @return mixed|string
|
||||||
|
*/
|
||||||
|
public static function setTemplateId($tempKey = '')
|
||||||
|
{
|
||||||
|
if ($tempKey == '') return '';
|
||||||
|
return RoutineTemplate::where('tempkey', $tempKey)->where('status', 1)->value('tempid');
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 发送订阅模板消息
|
||||||
|
* @param string $tempCode 所需下发的模板编号
|
||||||
|
* @param string $openId 接收者(用户)的 openid
|
||||||
|
* @param array $dataKey 模板内容,不填则下发空模板
|
||||||
|
* @param string $link 点击模板卡片后的跳转页面,仅限本小程序内的页面。支持带参数,(示例index?foo=bar)。该字段不填则模板无跳转
|
||||||
|
* @return bool|\EasyWeChat\Support\Collection|null
|
||||||
|
*/
|
||||||
|
public static function sendTemplate(string $tempCode,string $openId,array $dataKey, string $link = '')
|
||||||
|
{
|
||||||
|
if (!$openId || !$tempCode) return false;
|
||||||
|
return MiniProgramService::sendSubscribeTemlate($openId, trim(self::setTemplateId(self::getConstants($tempCode))), $dataKey, $link);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**服务进度通知
|
||||||
|
* @param array $data
|
||||||
|
* @param null $url
|
||||||
|
* @param string $defaultColor
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
public static function sendAdminNoticeTemplate(array $data, $url = null, $defaultColor = '')
|
||||||
|
{
|
||||||
|
$adminIds = explode(',', trim(sys_config('site_store_admin_uids')));
|
||||||
|
$kefuIds = ServiceModel::where('notify', 1)->column('uid', 'uid');
|
||||||
|
if (empty($adminIds[0])) {
|
||||||
|
$adminList = array_unique($kefuIds);
|
||||||
|
} else {
|
||||||
|
$adminList = array_unique(array_merge($adminIds, $kefuIds));
|
||||||
|
}
|
||||||
|
if (!is_array($adminList) || empty($adminList)) return false;
|
||||||
|
foreach ($adminList as $uid) {
|
||||||
|
try {
|
||||||
|
$openid = WechatUser::uidToRoutineOpenid($uid);
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
// self::sendTemplate($openid,self::ADMIN_NOTICE,$data,$url,$defaultColor);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 返回所有支持的行业列表
|
||||||
|
* @return \EasyWeChat\Support\Collection
|
||||||
|
*/
|
||||||
|
public static function getIndustry()
|
||||||
|
{
|
||||||
|
return MiniProgramService::noticeService()->getIndustry();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改账号所属行业
|
||||||
|
* 主行业 副行业 代码
|
||||||
|
* IT科技 互联网/电子商务 1
|
||||||
|
* IT科技 IT软件与服务 2
|
||||||
|
* IT科技 IT硬件与设备 3
|
||||||
|
* IT科技 电子技术 4
|
||||||
|
* IT科技 通信与运营商 5
|
||||||
|
* IT科技 网络游戏 6
|
||||||
|
* 金融业 银行 7
|
||||||
|
* 金融业 基金|理财|信托 8
|
||||||
|
* 金融业 保险 9
|
||||||
|
* 餐饮 餐饮 10
|
||||||
|
* 酒店旅游 酒店 11
|
||||||
|
* 酒店旅游 旅游 12
|
||||||
|
* 运输与仓储 快递 13
|
||||||
|
* 运输与仓储 物流 14
|
||||||
|
* 运输与仓储 仓储 15
|
||||||
|
* 教育 培训 16
|
||||||
|
* 教育 院校 17
|
||||||
|
* 政府与公共事业 学术科研 18
|
||||||
|
* 政府与公共事业 交警 19
|
||||||
|
* 政府与公共事业 博物馆 20
|
||||||
|
* 政府与公共事业 公共事业|非盈利机构 21
|
||||||
|
* 医药护理 医药医疗 22
|
||||||
|
* 医药护理 护理美容 23
|
||||||
|
* 医药护理 保健与卫生 24
|
||||||
|
* 交通工具 汽车相关 25
|
||||||
|
* 交通工具 摩托车相关 26
|
||||||
|
* 交通工具 火车相关 27
|
||||||
|
* 交通工具 飞机相关 28
|
||||||
|
* 房地产 建筑 29
|
||||||
|
* 房地产 物业 30
|
||||||
|
* 消费品 消费品 31
|
||||||
|
* 商业服务 法律 32
|
||||||
|
* 商业服务 会展 33
|
||||||
|
* 商业服务 中介服务 34
|
||||||
|
* 商业服务 认证 35
|
||||||
|
* 商业服务 审计 36
|
||||||
|
* 文体娱乐 传媒 37
|
||||||
|
* 文体娱乐 体育 38
|
||||||
|
* 文体娱乐 娱乐休闲 39
|
||||||
|
* 印刷 印刷 40
|
||||||
|
* 其它 其它 41
|
||||||
|
* @param $industryId1
|
||||||
|
* @param $industryId2
|
||||||
|
* @return \EasyWeChat\Support\Collection
|
||||||
|
*/
|
||||||
|
public static function setIndustry($industryId1, $industryId2)
|
||||||
|
{
|
||||||
|
return MiniProgramService::noticeService()->setIndustry($industryId1, $industryId2);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取所有模板列表
|
||||||
|
* @return \EasyWeChat\Support\Collection
|
||||||
|
*/
|
||||||
|
public static function getPrivateTemplates()
|
||||||
|
{
|
||||||
|
return MiniProgramService::noticeService()->getPrivateTemplates();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除指定ID的模板
|
||||||
|
* @param $templateId
|
||||||
|
* @return \EasyWeChat\Support\Collection
|
||||||
|
*/
|
||||||
|
public static function deletePrivateTemplate($templateId)
|
||||||
|
{
|
||||||
|
return MiniProgramService::noticeService()->deletePrivateTemplate($templateId);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 添加模板并获取模板ID
|
||||||
|
* @param $shortId
|
||||||
|
* @return \EasyWeChat\Support\Collection
|
||||||
|
*/
|
||||||
|
public static function addTemplate($shortId)
|
||||||
|
{
|
||||||
|
return MiniProgramService::noticeService()->addTemplate($shortId);
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -13,6 +13,7 @@ use crmeb\services\storage\Qiniu;
|
|||||||
use crmeb\traits\LogicTrait;
|
use crmeb\traits\LogicTrait;
|
||||||
use think\exception\ValidateException;
|
use think\exception\ValidateException;
|
||||||
use think\facade\Filesystem;
|
use think\facade\Filesystem;
|
||||||
|
use Guzzle\Http\EntityBody;
|
||||||
use think\File;
|
use think\File;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -191,7 +192,7 @@ class UploadService
|
|||||||
{
|
{
|
||||||
$info = [];
|
$info = [];
|
||||||
try {
|
try {
|
||||||
$uploadType = $this->uploadType ?: sysConfig('upload_type');
|
$uploadType = $this->uploadType ?: sys_config('upload_type');
|
||||||
//TODO 没有选择默认使用本地上传
|
//TODO 没有选择默认使用本地上传
|
||||||
if (!$uploadType)
|
if (!$uploadType)
|
||||||
$uploadType = 1;
|
$uploadType = 1;
|
||||||
@ -257,8 +258,6 @@ class UploadService
|
|||||||
if (!isset($header['Content-Length'])) $header['Content-Length'] = 0;
|
if (!isset($header['Content-Length'])) $header['Content-Length'] = 0;
|
||||||
if (!isset($header['Content-Type'])) $header['Content-Type'] = 'image/jpeg';
|
if (!isset($header['Content-Type'])) $header['Content-Type'] = 'image/jpeg';
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
$header['Content-Length'] = 0;
|
|
||||||
$header['Content-Type'] = 'image/jpeg';
|
|
||||||
}
|
}
|
||||||
return $header;
|
return $header;
|
||||||
}
|
}
|
||||||
@ -301,7 +300,7 @@ class UploadService
|
|||||||
*/
|
*/
|
||||||
public function uploadLocalStream($key, $content, $root = '')
|
public function uploadLocalStream($key, $content, $root = '')
|
||||||
{
|
{
|
||||||
$siteUrl = sysConfig('site_url') . '/';
|
$siteUrl = sys_config('site_url') . '/';
|
||||||
$path = self::uploadDir($this->uploadPath, $root);
|
$path = self::uploadDir($this->uploadPath, $root);
|
||||||
$path = str_replace('\\', DS, $path);
|
$path = str_replace('\\', DS, $path);
|
||||||
$path = str_replace('/', DS, $path);
|
$path = str_replace('/', DS, $path);
|
||||||
@ -325,7 +324,7 @@ class UploadService
|
|||||||
*/
|
*/
|
||||||
public function imageStream($key, $content, $root = '')
|
public function imageStream($key, $content, $root = '')
|
||||||
{
|
{
|
||||||
$uploadType = sysConfig('upload_type');
|
$uploadType = sys_config('upload_type');
|
||||||
//TODO 没有选择默认使用本地上传
|
//TODO 没有选择默认使用本地上传
|
||||||
if (!$uploadType) $uploadType = 1;
|
if (!$uploadType) $uploadType = 1;
|
||||||
$info = [];
|
$info = [];
|
||||||
@ -405,11 +404,10 @@ class UploadService
|
|||||||
*/
|
*/
|
||||||
public function file($fileName)
|
public function file($fileName)
|
||||||
{
|
{
|
||||||
if (!isset($_FILES[$fileName])) return self::setError('上传文件不存在!');
|
|
||||||
$extension = strtolower(pathinfo($_FILES[$fileName]['name'], PATHINFO_EXTENSION));
|
|
||||||
if (strtolower($extension) == 'php' || !$extension)
|
|
||||||
return self::setError('上传文件非法!');
|
|
||||||
$file = request()->file($fileName);
|
$file = request()->file($fileName);
|
||||||
|
if (!$file) return self::setError('上传文件不存在!');
|
||||||
|
if (strtolower($file->getOriginalExtension()) === 'php' || !$file->getOriginalExtension())
|
||||||
|
return self::setError('上传文件非法!');
|
||||||
if ($this->autoValidate) {
|
if ($this->autoValidate) {
|
||||||
try {
|
try {
|
||||||
validate([$fileName => $this->imageValidate])->check([$fileName => $file]);
|
validate([$fileName => $this->imageValidate])->check([$fileName => $file]);
|
||||||
@ -422,11 +420,11 @@ class UploadService
|
|||||||
return self::successful(str_replace('\\', '/', $fileName));
|
return self::successful(str_replace('\\', '/', $fileName));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function pathToUrl($path)
|
/**
|
||||||
{
|
* 打开图片
|
||||||
return trim(str_replace(DS, '/', $path), '.');
|
* @param $filePath
|
||||||
}
|
* @return \think\Image
|
||||||
|
*/
|
||||||
public function openImage($filePath)
|
public function openImage($filePath)
|
||||||
{
|
{
|
||||||
return \think\Image::open($filePath);
|
return \think\Image::open($filePath);
|
||||||
@ -443,7 +441,13 @@ class UploadService
|
|||||||
*/
|
*/
|
||||||
public function thumb($filePath, $ratio = 5, $pre = 's_')
|
public function thumb($filePath, $ratio = 5, $pre = 's_')
|
||||||
{
|
{
|
||||||
|
try {
|
||||||
$img = $this->openImage($filePath);
|
$img = $this->openImage($filePath);
|
||||||
|
} catch (\Throwable $e) {
|
||||||
|
$dir = dirname($filePath);
|
||||||
|
$fileName = basename($filePath);
|
||||||
|
return $dir . DS . $fileName;
|
||||||
|
}
|
||||||
$width = $img->width() * $ratio / 10;
|
$width = $img->width() * $ratio / 10;
|
||||||
$height = $img->height() * $ratio / 10;
|
$height = $img->height() * $ratio / 10;
|
||||||
$dir = dirname($filePath);
|
$dir = dirname($filePath);
|
||||||
@ -453,4 +457,14 @@ class UploadService
|
|||||||
if (substr($savePath, 0, 2) == './') return substr($savePath, 1, strlen($savePath));
|
if (substr($savePath, 0, 2) == './') return substr($savePath, 1, strlen($savePath));
|
||||||
return DS . $savePath;
|
return DS . $savePath;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* TODO 转为文件流
|
||||||
|
* @param $resource
|
||||||
|
* @return EntityBody
|
||||||
|
*/
|
||||||
|
public static function resourceStream($resource)
|
||||||
|
{
|
||||||
|
return EntityBody::factory($resource)->__toString();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@ -3,6 +3,7 @@
|
|||||||
namespace crmeb\services;
|
namespace crmeb\services;
|
||||||
|
|
||||||
use app\models\system\Cache as CacheModel;
|
use app\models\system\Cache as CacheModel;
|
||||||
|
use crmeb\exceptions\AuthException;
|
||||||
use crmeb\interfaces\ProviderInterface;
|
use crmeb\interfaces\ProviderInterface;
|
||||||
use crmeb\traits\LogicTrait;
|
use crmeb\traits\LogicTrait;
|
||||||
|
|
||||||
|
|||||||
@ -4,6 +4,7 @@
|
|||||||
* @author: xaboy<365615158@qq.com>
|
* @author: xaboy<365615158@qq.com>
|
||||||
* @day: 2017/11/11
|
* @day: 2017/11/11
|
||||||
*/
|
*/
|
||||||
|
|
||||||
namespace crmeb\traits;
|
namespace crmeb\traits;
|
||||||
|
|
||||||
use think\db\Query;
|
use think\db\Query;
|
||||||
@ -20,7 +21,8 @@ trait ModelTrait
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function all($function){
|
public static function all($function)
|
||||||
|
{
|
||||||
$query = self::newQuery();
|
$query = self::newQuery();
|
||||||
$function($query);
|
$function($query);
|
||||||
return $query->select();
|
return $query->select();
|
||||||
@ -129,6 +131,7 @@ trait ModelTrait
|
|||||||
$total = $list->total();
|
$total = $list->total();
|
||||||
return compact('list', 'page', 'total');
|
return compact('list', 'page', 'total');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取分页 生成where 条件和 whereOr 支持多表查询生成条件
|
* 获取分页 生成where 条件和 whereOr 支持多表查询生成条件
|
||||||
* @param object $model 模型对象
|
* @param object $model 模型对象
|
||||||
@ -139,7 +142,8 @@ trait ModelTrait
|
|||||||
* @param string $like 模糊查找 关键字
|
* @param string $like 模糊查找 关键字
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
public static function setWherePage($model=null,$where=[],$field=[],$fieldOr=[],$fun=null,$like='LIKE'){
|
public static function setWherePage($model = null, $where = [], $field = [], $fieldOr = [], $fun = null, $like = 'LIKE')
|
||||||
|
{
|
||||||
if (!is_array($where) || !is_array($field)) return false;
|
if (!is_array($where) || !is_array($field)) return false;
|
||||||
if ($model === null) $model = new self();
|
if ($model === null) $model = new self();
|
||||||
//处理等于行查询
|
//处理等于行查询
|
||||||
@ -173,13 +177,15 @@ trait ModelTrait
|
|||||||
unset($count, $key, $item, $item_l);
|
unset($count, $key, $item, $item_l);
|
||||||
return $model;
|
return $model;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 字符串拼接
|
* 字符串拼接
|
||||||
* @param int|array $id
|
* @param int|array $id
|
||||||
* @param string $str
|
* @param string $str
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
private static function get_field($id,$str='|'){
|
private static function get_field($id, $str = '|')
|
||||||
|
{
|
||||||
if (is_array($id)) {
|
if (is_array($id)) {
|
||||||
$sql = "";
|
$sql = "";
|
||||||
$i = 0;
|
$i = 0;
|
||||||
@ -196,27 +202,35 @@ trait ModelTrait
|
|||||||
return $id;
|
return $id;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 条件切割
|
* 条件切割
|
||||||
* @param string $order
|
* @param string $order
|
||||||
* @param string $file
|
* @param string $file
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public static function setOrder($order,$file='-'){
|
public static function setOrder($order, $file = '-')
|
||||||
|
{
|
||||||
if (empty($order)) return '';
|
if (empty($order)) return '';
|
||||||
return str_replace($file, ' ', $order);
|
return str_replace($file, ' ', $order);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取时间段之间的model
|
* 获取时间段之间的model
|
||||||
* @param int|string $time
|
* @param int|string $time
|
||||||
* @param string $ceil
|
* @param string $ceil
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
public static function getModelTime($where,$model=null,$prefix='add_time',$data='data',$field=' - '){
|
public static function getModelTime($where, $model = null, $prefix = 'add_time', $data = 'data', $field = ' - ')
|
||||||
|
{
|
||||||
if ($model == null) $model = new self;
|
if ($model == null) $model = new self;
|
||||||
if (!isset($where[$data])) return $model;
|
if (!isset($where[$data])) return $model;
|
||||||
switch ($where[$data]) {
|
switch ($where[$data]) {
|
||||||
case 'today':case 'week':case 'month':case 'year':case 'yesterday':
|
case 'today':
|
||||||
|
case 'week':
|
||||||
|
case 'month':
|
||||||
|
case 'year':
|
||||||
|
case 'yesterday':
|
||||||
$model = $model->whereTime($prefix, $where[$data]);
|
$model = $model->whereTime($prefix, $where[$data]);
|
||||||
break;
|
break;
|
||||||
case 'quarter':
|
case 'quarter':
|
||||||
@ -240,14 +254,17 @@ trait ModelTrait
|
|||||||
}
|
}
|
||||||
return $model;
|
return $model;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取去除html去除空格去除软回车,软换行,转换过后的字符串
|
* 获取去除html去除空格去除软回车,软换行,转换过后的字符串
|
||||||
* @param string $str
|
* @param string $str
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public static function HtmlToMbStr($str){
|
public static function HtmlToMbStr($str)
|
||||||
|
{
|
||||||
return trim(strip_tags(str_replace(["\n", "\t", "\r", " ", " "], '', htmlspecialchars_decode($str))));
|
return trim(strip_tags(str_replace(["\n", "\t", "\r", " ", " "], '', htmlspecialchars_decode($str))));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 截取中文指定字节
|
* 截取中文指定字节
|
||||||
* @param string $str
|
* @param string $str
|
||||||
@ -256,19 +273,22 @@ trait ModelTrait
|
|||||||
* @param string $file
|
* @param string $file
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public static function getSubstrUTf8($str,$utf8len=100,$chaet='UTF-8',$file='....'){
|
public static function getSubstrUTf8($str, $utf8len = 100, $chaet = 'UTF-8', $file = '....')
|
||||||
|
{
|
||||||
if (mb_strlen($str, $chaet) > $utf8len) {
|
if (mb_strlen($str, $chaet) > $utf8len) {
|
||||||
$str = mb_substr($str, 0, $utf8len, $chaet) . $file;
|
$str = mb_substr($str, 0, $utf8len, $chaet) . $file;
|
||||||
}
|
}
|
||||||
return $str;
|
return $str;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取本季度 time
|
* 获取本季度 time
|
||||||
* @param int|string $time
|
* @param int|string $time
|
||||||
* @param string $ceil
|
* @param string $ceil
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
public static function getMonth($time='',$ceil=0){
|
public static function getMonth($time = '', $ceil = 0)
|
||||||
|
{
|
||||||
if ($ceil != 0)
|
if ($ceil != 0)
|
||||||
$season = ceil(date('n') / 3) - $ceil;
|
$season = ceil(date('n') / 3) - $ceil;
|
||||||
else
|
else
|
||||||
@ -277,6 +297,7 @@ trait ModelTrait
|
|||||||
$lastday = date('Y-m-t', mktime(0, 0, 0, $season * 3, 1, date('Y')));
|
$lastday = date('Y-m-t', mktime(0, 0, 0, $season * 3, 1, date('Y')));
|
||||||
return array($firstday, $lastday);
|
return array($firstday, $lastday);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 高精度 加法
|
* 高精度 加法
|
||||||
* @param int|string $uid id
|
* @param int|string $uid id
|
||||||
|
|||||||
@ -11,18 +11,19 @@ use EasyWeChat\Core\Exceptions\InvalidArgumentException;
|
|||||||
* Class ProgramSubscribe
|
* Class ProgramSubscribe
|
||||||
* @package crmeb\utils
|
* @package crmeb\utils
|
||||||
* @method $this
|
* @method $this
|
||||||
* @method $this withTemplate(string $template_id) 设置模板id
|
* @method $this template(string $template_id) 设置模板id
|
||||||
* @method $this withTemplateId(string $template_id) 设置模板id
|
* @method $this withTemplateId(string $template_id) 设置模板id
|
||||||
* @method $this andTemplateId(string $template_id) 设置模板id
|
* @method $this andTemplateId(string $template_id) 设置模板id
|
||||||
* @method $this andTemplate(string $template_id) 设置模板id
|
* @method $this andTemplate(string $template_id) 设置模板id
|
||||||
* @method $this andUses(string $template_id) 设置模板id
|
* @method $this andUses(string $template_id) 设置模板id
|
||||||
* @method $this andTo(string $touser) 设置opendid
|
* @method $this to(string $touser) 设置opendid
|
||||||
* @method $this andReceiver(string $touser) 设置opendid
|
* @method $this andReceiver(string $touser) 设置opendid
|
||||||
* @method $this withReceiver(string $touser) 设置opendid
|
* @method $this withReceiver(string $touser) 设置opendid
|
||||||
* @method $this with(array $data) 设置发送内容
|
* @method $this with(array $data) 设置发送内容
|
||||||
* @method $this andData(array $data) 设置发送内容
|
* @method $this andData(array $data) 设置发送内容
|
||||||
* @method $this withData(array $data) 设置发送内容
|
* @method $this withData(array $data) 设置发送内容
|
||||||
* @method $this data(array $data) 设置发送内容
|
* @method $this data(array $data) 设置发送内容
|
||||||
|
* @method $this withUrl(string $page) 设置跳转路径
|
||||||
*/
|
*/
|
||||||
class ProgramSubscribe extends AbstractAPI
|
class ProgramSubscribe extends AbstractAPI
|
||||||
{
|
{
|
||||||
@ -205,13 +206,33 @@ class ProgramSubscribe extends AbstractAPI
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* TODO: 未实现
|
* 设置订阅消息发送data
|
||||||
* @param $data
|
* @param array $data
|
||||||
* @return mixed
|
* @return array
|
||||||
*/
|
*/
|
||||||
protected function formatData($data)
|
protected function formatData(array $data)
|
||||||
{
|
{
|
||||||
return $data;
|
$return = [];
|
||||||
|
|
||||||
|
foreach ($data as $key => $item) {
|
||||||
|
if (is_scalar($item)) {
|
||||||
|
$value = $item;
|
||||||
|
} elseif (is_array($item) && !empty($item)) {
|
||||||
|
if (isset($item['value'])) {
|
||||||
|
$value = strval($item['value']);
|
||||||
|
} elseif (count($item) < 2) {
|
||||||
|
$value = array_shift($item);
|
||||||
|
} else {
|
||||||
|
[$value] = $item;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$value = 'error data item.';
|
||||||
|
}
|
||||||
|
|
||||||
|
$return[$key] = ['value' => $value];
|
||||||
|
}
|
||||||
|
|
||||||
|
return $return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -230,8 +251,8 @@ class ProgramSubscribe extends AbstractAPI
|
|||||||
'uses' => 'template_id',
|
'uses' => 'template_id',
|
||||||
'to' => 'touser',
|
'to' => 'touser',
|
||||||
'receiver' => 'touser',
|
'receiver' => 'touser',
|
||||||
'url' => 'url',
|
'url' => 'page',
|
||||||
'link' => 'url',
|
'link' => 'page',
|
||||||
'data' => 'data',
|
'data' => 'data',
|
||||||
'with' => 'data',
|
'with' => 'data',
|
||||||
];
|
];
|
||||||
|
|||||||
@ -20,22 +20,24 @@ use think\app\Url;
|
|||||||
* @method $this setTemplateFormId(string $templateFormId) 设置发送模板消息formid
|
* @method $this setTemplateFormId(string $templateFormId) 设置发送模板消息formid
|
||||||
* @method $this setTemplateDefaultColor(string $templateDefaultColor) 设置发送模板消息默认背景颜色
|
* @method $this setTemplateDefaultColor(string $templateDefaultColor) 设置发送模板消息默认背景颜色
|
||||||
* @method $this setTemplateCode(string $templateCode) 设置模板id
|
* @method $this setTemplateCode(string $templateCode) 设置模板id
|
||||||
* @method $this setSendType($sendType) 设置发送类型句柄 1 = 小程序 , 2 = 公众号
|
* @method $this setHandleType($handleType) 设置发送类型句柄 1 = 小程序 , 2 = 公众号
|
||||||
* @method $this setDefaultData($defaultData) 设置默认数据
|
* @method $this setDefaultData($defaultData) 设置默认数据
|
||||||
* @method $this setTemplateUrl(Url $url, string $sux = '') 设置跳转Url
|
* @method $this setTemplateUrl(Url $url, string $sux = '') 设置跳转Url
|
||||||
* @method $this routine() 设置当前发送类型句柄为 小程序
|
* @method $this routine() 设置当前发送类型句柄为 小程序
|
||||||
* @method $this wechat() 设置当前发送类型句柄为 公众号
|
* @method $this wechat() 设置当前发送类型句柄为 公众号
|
||||||
|
* @method $this subscribe() 设置当前发送类型句柄为 小程序订阅消息
|
||||||
*/
|
*/
|
||||||
class Template
|
class Template
|
||||||
{
|
{
|
||||||
use LogicTrait;
|
use LogicTrait;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 注册服务 会自动添加$providers对应的key名称方法方便设置$sendType
|
* 注册服务 会自动添加$providers对应的key名称方法方便设置$handleType
|
||||||
* @var array
|
* @var array
|
||||||
*/
|
*/
|
||||||
protected $providers = [
|
protected $providers = [
|
||||||
'routine' => \crmeb\services\ProgramTemplateService::class,
|
'routine' => \crmeb\services\ProgramTemplateService::class,
|
||||||
|
'subscribe' => \crmeb\services\SubscribeTemplateService::class,
|
||||||
'wechat' => \crmeb\services\WechatTemplateService::class,
|
'wechat' => \crmeb\services\WechatTemplateService::class,
|
||||||
];
|
];
|
||||||
|
|
||||||
@ -49,7 +51,7 @@ class Template
|
|||||||
'templateData' => [[], 'array'],
|
'templateData' => [[], 'array'],
|
||||||
'templateUrl' => [null, 'callable', 'postpositionUrl'],
|
'templateUrl' => [null, 'callable', 'postpositionUrl'],
|
||||||
'templateFormId' => [null, 'string'],
|
'templateFormId' => [null, 'string'],
|
||||||
'sendType' => [null, 'string'],
|
'handleType' => [null, 'string'],
|
||||||
'templateOpenId' => [null, 'string'],
|
'templateOpenId' => [null, 'string'],
|
||||||
'templateOpenId' => [null, 'string'],
|
'templateOpenId' => [null, 'string'],
|
||||||
];
|
];
|
||||||
@ -88,7 +90,7 @@ class Template
|
|||||||
* 发送类型 对应 $providers key
|
* 发送类型 对应 $providers key
|
||||||
* @var string | int
|
* @var string | int
|
||||||
*/
|
*/
|
||||||
protected $sendType;
|
protected $handleType;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 接收人openid 小程序 和 公众号使用
|
* 接收人openid 小程序 和 公众号使用
|
||||||
@ -129,16 +131,16 @@ class Template
|
|||||||
protected function validate()
|
protected function validate()
|
||||||
{
|
{
|
||||||
$keys = array_keys($this->providers);
|
$keys = array_keys($this->providers);
|
||||||
if (is_string($this->sendType)) {
|
if (is_string($this->handleType)) {
|
||||||
if (!in_array($this->sendType, $keys))
|
if (!in_array($this->handleType, $keys))
|
||||||
throw new AuthException('设置的发送类型句柄不存在:' . $this->sendType);
|
throw new AuthException('设置的发送类型句柄不存在:' . $this->handleType);
|
||||||
} elseif (is_int($this->sendType)) {
|
} elseif (is_int($this->handleType)) {
|
||||||
if ($this->sendType > count($keys))
|
if ($this->handleType > count($keys))
|
||||||
throw new AuthException('设置的发送类型句柄不存在:' . $this->sendType);
|
throw new AuthException('设置的发送类型句柄不存在:' . $this->handleType);
|
||||||
$this->sendType = $keys[$this->sendType - 1];
|
$this->handleType = $keys[$this->handleType - 1];
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$this->sendType)
|
if (!$this->handleType)
|
||||||
throw new AuthException('请设置发送类型句柄');
|
throw new AuthException('请设置发送类型句柄');
|
||||||
|
|
||||||
if (!$this->templateData)
|
if (!$this->templateData)
|
||||||
@ -160,7 +162,7 @@ class Template
|
|||||||
$this->validate();
|
$this->validate();
|
||||||
|
|
||||||
$resource = null;
|
$resource = null;
|
||||||
switch ($this->sendType) {
|
switch ($this->handleType) {
|
||||||
case 'routine':
|
case 'routine':
|
||||||
$resource = self::$instance->routine->sendTemplate(
|
$resource = self::$instance->routine->sendTemplate(
|
||||||
$this->templateCode,
|
$this->templateCode,
|
||||||
@ -180,6 +182,14 @@ class Template
|
|||||||
$this->templateDefaultColor
|
$this->templateDefaultColor
|
||||||
);
|
);
|
||||||
break;
|
break;
|
||||||
|
case 'subscribe':
|
||||||
|
$resource = self::$instance->subscribe->sendTemplate(
|
||||||
|
$this->templateCode,
|
||||||
|
$this->templateOpenId,
|
||||||
|
$this->templateData,
|
||||||
|
$this->templateUrl
|
||||||
|
);
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
$resource = false;
|
$resource = false;
|
||||||
break;
|
break;
|
||||||
@ -206,7 +216,7 @@ class Template
|
|||||||
$this->templateDefaultColor = null;
|
$this->templateDefaultColor = null;
|
||||||
$this->templateData = [];
|
$this->templateData = [];
|
||||||
$this->templateUrl = null;
|
$this->templateUrl = null;
|
||||||
$this->sendType = null;
|
$this->handleType = null;
|
||||||
$this->templateFormId = null;
|
$this->templateFormId = null;
|
||||||
$this->templateCode = null;
|
$this->templateCode = null;
|
||||||
return $this;
|
return $this;
|
||||||
|
|||||||
@ -258,7 +258,8 @@ switch ($step) {
|
|||||||
if ($ret) {
|
if ($ret) {
|
||||||
$message = '<li><span class="correct_span">√</span>创建数据表['.$dbPrefix.$matches[2] . ']完成!<span style="float: right;">'.date('Y-m-d H:i:s').'</span></li> ';
|
$message = '<li><span class="correct_span">√</span>创建数据表['.$dbPrefix.$matches[2] . ']完成!<span style="float: right;">'.date('Y-m-d H:i:s').'</span></li> ';
|
||||||
} else {
|
} else {
|
||||||
$message = '<li><span class="correct_span error_span">√</span>创建数据表['.$dbPrefix.$matches[2] . ']失败!<span style="float: right;">'.date('Y-m-d H:i:s').'</span></li>';
|
$err = mysqli_error($conn);
|
||||||
|
$message = '<li><span class="correct_span error_span">√</span>创建数据表['.$dbPrefix.$matches[2] . ']失败!失败原因:'.$err.'<span style="float: right;">'.date('Y-m-d H:i:s').'</span></li>';
|
||||||
}
|
}
|
||||||
$i++;
|
$i++;
|
||||||
$arr = array('n' => $i, 'msg' => $message);
|
$arr = array('n' => $i, 'msg' => $message);
|
||||||
|
|||||||
@ -283,8 +283,7 @@
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
setNoticeDate:function(data)
|
setNoticeDate: function (data) {
|
||||||
{
|
|
||||||
$('#msgcount').html(data.msgcount);
|
$('#msgcount').html(data.msgcount);
|
||||||
$('#ordernum').html(data.ordernum + '个');
|
$('#ordernum').html(data.ordernum + '个');
|
||||||
$('#inventory').html(data.inventory + '个');
|
$('#inventory').html(data.inventory + '个');
|
||||||
@ -391,8 +390,9 @@
|
|||||||
console.log('ws error', e.data ? JSON.parse(e.data).message : '');
|
console.log('ws error', e.data ? JSON.parse(e.data).message : '');
|
||||||
},
|
},
|
||||||
getUrl: function () {
|
getUrl: function () {
|
||||||
var ishttps = 'https:' == document.location.protocol ? true : false;
|
var ishttps = 'https:' == document.location.protocol ? true : false,
|
||||||
return ( ishttps ? 'wss': 'ws' )+'://' + document.URL.split('//')[1].split('/')[0] + ':20002';
|
workermanPort = window.workermanPort ? window.workermanPort : 20002;
|
||||||
|
return (ishttps ? 'wss' : 'ws') + '://' + document.URL.split('//')[1].split('/')[0] + ':' + workermanPort;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@ -1,7 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
use think\facade\Route;
|
use think\facade\Route;
|
||||||
|
|
||||||
//账号密码登录
|
//账号密码登录
|
||||||
Route::post('login', 'AuthController/login')->name('login')
|
Route::post('login', 'AuthController/login')->name('login')
|
||||||
->middleware(\app\http\middleware\AllowOriginMiddleware::class);
|
->middleware(\app\http\middleware\AllowOriginMiddleware::class);
|
||||||
@ -194,6 +193,7 @@ Route::group(function () {
|
|||||||
Route::post('wechat/mp_auth', 'wechat.AuthController/mp_auth')->name('mpAuth');//小程序登陆
|
Route::post('wechat/mp_auth', 'wechat.AuthController/mp_auth')->name('mpAuth');//小程序登陆
|
||||||
Route::get('wechat/get_logo', 'wechat.AuthController/get_logo')->name('getLogo');//小程序登陆授权展示logo
|
Route::get('wechat/get_logo', 'wechat.AuthController/get_logo')->name('getLogo');//小程序登陆授权展示logo
|
||||||
Route::post('wechat/set_form_id', 'wechat.AuthController/set_form_id')->name('setFormId');//小程序登陆收集form id
|
Route::post('wechat/set_form_id', 'wechat.AuthController/set_form_id')->name('setFormId');//小程序登陆收集form id
|
||||||
|
Route::get('wechat/teml_ids', 'wechat.AuthController/teml_ids')->name('wechatTemlIds');//微信授权
|
||||||
|
|
||||||
//物流公司
|
//物流公司
|
||||||
Route::get('logistics', 'PublicController/logistics')->name('logistics');//物流公司列表
|
Route::get('logistics', 'PublicController/logistics')->name('logistics');//物流公司列表
|
||||||
@ -210,6 +210,7 @@ Route::group(function () {
|
|||||||
//获取关注微信公众号海报
|
//获取关注微信公众号海报
|
||||||
Route::get('wechat/follow','wechat.WechatController/follow')->name('Follow');
|
Route::get('wechat/follow','wechat.WechatController/follow')->name('Follow');
|
||||||
|
|
||||||
|
|
||||||
})->middleware(\app\http\middleware\AllowOriginMiddleware::class)->middleware(\app\http\middleware\AuthTokenMiddleware::class, false);
|
})->middleware(\app\http\middleware\AllowOriginMiddleware::class)->middleware(\app\http\middleware\AuthTokenMiddleware::class, false);
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user