mirror of
https://github.com/crmeb/CRMEB.git
synced 2025-12-12 11:09:23 +00:00
调整上传图片获取静态句柄方法名
This commit is contained in:
parent
5fead1d61a
commit
8875a1e82b
@ -12,9 +12,7 @@ use app\admin\model\user\UserExtract as UserExtractModel;//分销
|
||||
use app\admin\model\user\User as UserModel;//用户
|
||||
use app\admin\model\store\StoreProductReply as StoreProductReplyModel;//评论
|
||||
use app\admin\model\store\StoreProduct as ProductModel;//产品
|
||||
use crmeb\utils\Template;
|
||||
use FormBuilder\Json;
|
||||
use think\facade\Route;
|
||||
|
||||
/**
|
||||
* 首页控制器
|
||||
@ -39,22 +37,6 @@ class Index extends AuthController
|
||||
return $this->fetch();
|
||||
}
|
||||
|
||||
public function test()
|
||||
{
|
||||
$res = Template::instance()->wechat()
|
||||
->setTemplateCode('OPENTM207791277')
|
||||
->setTemplateData([
|
||||
'first'=>'亲,您购买的商品已支付成功',
|
||||
'keyword1'=>'wx12545454545',
|
||||
'keyword2'=>'0.99',
|
||||
'remark'=>'点击查看订单详情'
|
||||
])
|
||||
->setTemplateOpenId('od9iXwj58C4aLy11ABMxFkgJelt0')
|
||||
->setTemplateUrl(Route::buildUrl('order/detail/wx12545454545'))
|
||||
->send();
|
||||
var_dump($res);
|
||||
}
|
||||
|
||||
//后台首页内容
|
||||
public function main()
|
||||
{
|
||||
|
||||
@ -211,7 +211,7 @@ class AgentManage extends AuthController
|
||||
if(!$imageInfo){
|
||||
$res = \app\models\routine\RoutineCode::getShareCode($uid, 'spread', '', '');
|
||||
if(!$res) throw new \think\Exception('二维码生成失败');
|
||||
$imageInfo = UploadService::getInstance()->setUploadPath('routine/spread/code')->imageStream($name,$res['res']);
|
||||
$imageInfo = UploadService::instance()->setUploadPath('routine/spread/code')->imageStream($name,$res['res']);
|
||||
if(!is_array($imageInfo)) return $imageInfo;
|
||||
SystemAttachment::attachmentAdd($imageInfo['name'],$imageInfo['size'],$imageInfo['type'],$imageInfo['dir'],$imageInfo['thumb_path'],1,$imageInfo['image_type'],$imageInfo['time']);
|
||||
RoutineQrcode::setRoutineQrcodeFind($res['id'],['status'=>1,'time'=>time(),'qrcode_url'=>$imageInfo['dir']]);
|
||||
@ -221,11 +221,11 @@ class AgentManage extends AuthController
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
* 获取公众号二维码
|
||||
* */
|
||||
public function wechant_code($uid)
|
||||
{
|
||||
$qr_code = \crmeb\services\QrcodeService::getTemporaryQrcode('spread',$uid);
|
||||
$qr_code = \crmeb\services\QrcodeService::getForeverQrcode('spread',$uid);
|
||||
if(isset($qr_code['url']))
|
||||
return ['code_src'=>$qr_code['url']];
|
||||
else
|
||||
@ -246,7 +246,7 @@ class AgentManage extends AuthController
|
||||
if(!$imageInfo){
|
||||
$res = \app\models\routine\RoutineCode::getShareCode($uid, 'spread', '', '');
|
||||
if(!$res) return JsonService::fail('二维码生成失败');
|
||||
$imageInfo = UploadService::getInstance()->setUploadPath('routine/spread/code')->imageStream($name,$res['res']);
|
||||
$imageInfo = UploadService::instance()->setUploadPath('routine/spread/code')->imageStream($name,$res['res']);
|
||||
if(!is_array($imageInfo)) return JsonService::fail($imageInfo);
|
||||
SystemAttachment::attachmentAdd($imageInfo['name'],$imageInfo['size'],$imageInfo['type'],$imageInfo['dir'],$imageInfo['thumb_path'],1,$imageInfo['image_type'],$imageInfo['time']);
|
||||
RoutineQrcode::setRoutineQrcodeFind($res['id'],['status'=>1,'time'=>time(),'qrcode_url'=>$imageInfo['dir']]);
|
||||
|
||||
@ -99,7 +99,7 @@ class Article extends AuthController
|
||||
* @return \think\response\Json
|
||||
*/
|
||||
public function upload_image(){
|
||||
$res = Upload::getInstance()->setUploadPath('wechat/image/'.date('Ymd'))->image($_POST['file']);
|
||||
$res = Upload::instance()->setUploadPath('wechat/image/'.date('Ymd'))->image($_POST['file']);
|
||||
if(!is_array($res)) return Json::fail($res);
|
||||
SystemAttachment::attachmentAdd($res['name'],$res['size'],$res['type'],$res['dir'],$res['thumb_path'],5,$res['image_type'],$res['time']);
|
||||
return Json::successful('上传成功!',['url'=>$res['dir']]);
|
||||
|
||||
@ -72,7 +72,7 @@ class ArticleCategory extends AuthController
|
||||
* s上传图片
|
||||
* */
|
||||
public function upload(){
|
||||
$res = Upload::getInstance()->setUploadPath('article')->image('file');
|
||||
$res = Upload::instance()->setUploadPath('article')->image('file');
|
||||
if(!is_array($res)) return Json::fail($res);
|
||||
SystemAttachment::attachmentAdd($res['name'],$res['size'],$res['type'],$res['dir'],$res['thumb_path'],5,$res['image_type'],$res['time']);
|
||||
return Json::successful('图片上传成功!',['name'=>$res['name'],'url'=>Upload::pathToUrl($res['thumb_path'])]);
|
||||
|
||||
@ -89,7 +89,7 @@ class WechatNews extends AuthController
|
||||
* @return \think\response\Json
|
||||
*/
|
||||
public function upload_image(){
|
||||
$res = Upload::getInstance()->setUploadPath('wechat/image/'.date('Ymd'))->image($_POST['file']);
|
||||
$res = Upload::instance()->setUploadPath('wechat/image/'.date('Ymd'))->image($_POST['file']);
|
||||
if(!is_array($res)) return Json::fail($res);
|
||||
SystemAttachment::attachmentAdd($res['name'],$res['size'],$res['type'],$res['dir'],$res['thumb_path'],5,$res['image_type'],$res['time']);
|
||||
return Json::successful('上传成功!',['url'=>$res['thumb_path']]);
|
||||
|
||||
@ -15,8 +15,6 @@ use crmeb\services\MiniProgramService;
|
||||
use crmeb\services\UtilService;
|
||||
use crmeb\services\WechatService;
|
||||
use crmeb\services\FormBuilder as Form;
|
||||
use crmeb\services\HookService;
|
||||
use crmeb\subscribes\OrderSubscribe;
|
||||
use app\admin\model\order\StoreOrderStatus;
|
||||
use app\admin\model\ump\StorePink;
|
||||
use app\admin\model\user\User;
|
||||
|
||||
@ -400,7 +400,7 @@ class SystemConfig extends AuthController
|
||||
* 文件上传
|
||||
* */
|
||||
public function file_upload(){
|
||||
$res = Upload::getInstance()->setUploadPath('config/file')->file($this->request->param('file','file'));
|
||||
$res = Upload::instance()->setUploadPath('config/file')->file($this->request->param('file','file'));
|
||||
if(!$res->status) return Json::fail($res->error);
|
||||
return Json::successful('上传成功!',['filePath'=>$res->filePath]);
|
||||
}
|
||||
|
||||
@ -255,7 +255,7 @@ class SystemGroupData extends AuthController
|
||||
|
||||
public function upload()
|
||||
{
|
||||
$res = Upload::getInstance()->setUploadPath('common')->image('file');
|
||||
$res = Upload::instance()->setUploadPath('common')->image('file');
|
||||
if(!is_array($res)) return Json::fail($res);
|
||||
SystemAttachment::attachmentAdd($res['name'],$res['size'],$res['type'],$res['dir'],$res['thumb_path'],6,$res['image_type'],$res['time']);
|
||||
return Json::successful('图片上传成功!',['name'=>$res['name'],'url'=>Upload::pathToUrl($res['thumb_path'])]);
|
||||
|
||||
@ -770,7 +770,7 @@ class CopyTaobao extends AuthController
|
||||
$size = strlen(trim($content));
|
||||
if (!$content || $size <= 2) return '图片流获取失败';
|
||||
$date_dir = date('Y') . DS . date('m') . DS . date('d');
|
||||
$imageInfo = UploadService::getInstance()->setUploadPath('attach/' . $date_dir)->imageStream($name, $content);
|
||||
$imageInfo = UploadService::instance()->setUploadPath('attach/' . $date_dir)->imageStream($name, $content);
|
||||
if (!is_array($imageInfo)) return $imageInfo;
|
||||
$date['path'] = $imageInfo['dir'];
|
||||
$date['name'] = $imageInfo['name'];
|
||||
|
||||
@ -107,7 +107,7 @@ class StoreCategory extends AuthController
|
||||
*/
|
||||
public function upload()
|
||||
{
|
||||
$res = Upload::getInstance()->setUploadPath('store/category'.date('Ymd'))->image('file');
|
||||
$res = Upload::instance()->setUploadPath('store/category'.date('Ymd'))->image('file');
|
||||
if(is_array($res)){
|
||||
SystemAttachment::attachmentAdd($res['name'],$res['size'],$res['type'],$res['dir'],$res['thumb_path'],1,$res['image_type'],$res['time']);
|
||||
return Json::successful('图片上传成功!',['name'=>$res['name'],'url'=>Upload::pathToUrl($res['thumb_path'])]);
|
||||
|
||||
@ -68,7 +68,7 @@ class StoreInfoMana extends AuthController
|
||||
* */
|
||||
public function upload()
|
||||
{
|
||||
$res = Upload::getInstance()->setUploadPath('article/'.date('Ymd'))->image('file');
|
||||
$res = Upload::instance()->setUploadPath('article/'.date('Ymd'))->image('file');
|
||||
SystemAttachment::attachmentAdd($res['name'],$res['size'],$res['type'],$res['dir'],$res['thumb_path'],2,$res['image_type'],$res['time']);
|
||||
if(is_array($res))
|
||||
return Json::successful('图片上传成功!',['name'=>$res['name'],'url'=>Upload::pathToUrl($res['thumb_path'])]);
|
||||
|
||||
@ -176,7 +176,7 @@ class StoreProduct extends AuthController
|
||||
*/
|
||||
public function upload()
|
||||
{
|
||||
$res = Upload::getInstance()->setUploadPath('store/product/'.date('Ymd'))->image('file');
|
||||
$res = Upload::instance()->setUploadPath('store/product/'.date('Ymd'))->image('file');
|
||||
SystemAttachment::attachmentAdd($res['name'],$res['size'],$res['type'],$res['dir'],$res['thumb_path'],1,$res['image_type'],$res['time']);
|
||||
if(is_array($res))
|
||||
return Json::successful('图片上传成功!',['name'=>$res['name'],'url'=>Upload::pathToUrl($res['thumb_path'])]);
|
||||
|
||||
@ -21,7 +21,7 @@ class SystemAttachment extends AuthController
|
||||
*/
|
||||
public function upload()
|
||||
{
|
||||
$res = Upload::getInstance()->setUploadPath('editor/'.date('Ymd'))->image('upfile');
|
||||
$res = Upload::instance()->setUploadPath('editor/'.date('Ymd'))->image('upfile');
|
||||
if(is_array($res)){
|
||||
SystemAttachmentModel::attachmentAdd($res['name'],$res['size'],$res['type'],$res['dir'],$res['thumb_path'],0,$res['image_type'],$res['time']);
|
||||
$info["originalName"] = $res['name'];
|
||||
|
||||
@ -191,7 +191,7 @@ class StoreSeckill extends AuthController
|
||||
*/
|
||||
public function upload()
|
||||
{
|
||||
$res = Upload::getInstance()->setUploadPath('store/product/'.date('Ymd'))->image('file');
|
||||
$res = Upload::instance()->setUploadPath('store/product/'.date('Ymd'))->image('file');
|
||||
if(is_array($res)){
|
||||
SystemAttachment::attachmentAdd($res['name'],$res['size'],$res['type'],$res['dir'],$res['thumb_path'],4,$res['image_type'],$res['time']);
|
||||
return Json::successful('图片上传成功!',['name'=>$res['name'],'url'=>Upload::pathToUrl($res['thumb_path'])]);
|
||||
|
||||
@ -82,7 +82,7 @@ class Reply extends AuthController
|
||||
{
|
||||
$name = $this->request->post('file');
|
||||
if(!$name) return Json::fail('请上传图片');
|
||||
$res = Upload::getInstance()->setUploadType(1)->setUploadPath('wechat/image')
|
||||
$res = Upload::instance()->setUploadType(1)->setUploadPath('wechat/image')
|
||||
->setAutoValidate(true)->image($name);
|
||||
if(!is_array($res)) return Json::fail($res);
|
||||
SystemAttachment::attachmentAdd($res['name'],$res['size'],$res['type'],$res['dir'],$res['thumb_path'],0,$res['image_type'],$res['time']);
|
||||
@ -93,7 +93,7 @@ class Reply extends AuthController
|
||||
{
|
||||
$name = $this->request->post('file');
|
||||
if(!$name) return Json::fail('请上传声音');
|
||||
$res = Upload::getInstance()->setUploadPath('wechat/voice')->setAutoValidate(true)->file($name);
|
||||
$res = Upload::instance()->setUploadPath('wechat/voice')->setAutoValidate(true)->file($name);
|
||||
return $res->status === true ? Json::successful('上传成功',$res->filePath) : Json::fail($res->error);
|
||||
}
|
||||
|
||||
|
||||
@ -91,7 +91,7 @@ class StoreService extends AuthController
|
||||
$f[] = Form::input('nickname','客服名称',$service["nickname"]);
|
||||
$f[] = Form::radio('customer','统计管理',$service['customer'])->options([['value'=>1,'label'=>'开启'],['value'=>0,'label'=>'关闭']]);
|
||||
$f[] = Form::radio('notify','订单通知',$service['notify'])->options([['value'=>1,'label'=>'开启'],['value'=>0,'label'=>'关闭']]);
|
||||
$f[] = Form::radio('status','客服状态',$service['status'])->options([['value'=>1,'label'=>'显示'],['value'=>0,'label'=>'隐藏']]);
|
||||
$f[] = Form::radio('status','客服状态',$service['status'])->options([['value'=>1,'label'=>'在线'],['value'=>0,'label'=>'离线']]);
|
||||
$form = Form::make_post_form('修改数据',$f,Url::buildUrl('update',compact('id')));
|
||||
$this->assign(compact('form'));
|
||||
return $this->fetch('public/form-builder');
|
||||
@ -136,7 +136,7 @@ class StoreService extends AuthController
|
||||
*/
|
||||
public function upload()
|
||||
{
|
||||
$res = Upload::getInstance()->setUploadPath('store/product/'.date('Ymd'))->image('file');
|
||||
$res = Upload::instance()->setUploadPath('store/product/'.date('Ymd'))->image('file');
|
||||
if(is_array($res)){
|
||||
SystemAttachment::attachmentAdd($res['name'],$res['size'],$res['type'],$res['dir'],$res['thumb_path'],2,$res['image_type'],$res['time']);
|
||||
return Json::successful('图片上传成功!',['name'=>$res['name'],'url'=>Upload::pathToUrl($res['thumb_path'])]);
|
||||
|
||||
@ -71,7 +71,7 @@ class Images extends AuthController
|
||||
$upload_type = $this->request->get('upload_type',0);
|
||||
try{
|
||||
$path = make_path('attach',2,true);
|
||||
$res = Upload::getInstance()->setUploadPath($path)->setAutoValidate(true)
|
||||
$res = Upload::instance()->setUploadPath($path)->setAutoValidate(true)
|
||||
->setUploadType($upload_type)->image('file');
|
||||
if(is_object($res) && $res->status === false){
|
||||
$info = array(
|
||||
|
||||
@ -58,7 +58,9 @@ class StoreStatistics extends BaseModel
|
||||
public static function getOrderInfo($where)
|
||||
{
|
||||
$orderinfo = self::getTimeWhere($where)
|
||||
->field('sum(total_price) total_price,sum(cost) cost,sum(pay_postage) pay_postage,sum(pay_price) pay_price,sum(coupon_price) coupon_price,sum(deduction_price) deduction_price,from_unixtime(pay_time,\'%Y-%m-%d\') pay_time')->order('pay_time')->group('from_unixtime(pay_time,\'%Y-%m-%d\')')->select()->toArray();
|
||||
->field('sum(total_price) total_price,sum(cost) cost,sum(pay_postage) pay_postage,sum(pay_price) pay_price,sum(coupon_price) coupon_price,sum(deduction_price) deduction_price,from_unixtime(pay_time,\'%Y-%m-%d\') pay_time')
|
||||
->order('pay_time')->where('paid',1)->where('refund_status',0)
|
||||
->group('from_unixtime(pay_time,\'%Y-%m-%d\')')->select()->toArray();
|
||||
$price = 0;
|
||||
$postage = 0;
|
||||
$deduction = 0;
|
||||
|
||||
@ -288,10 +288,10 @@ class StoreProduct extends BaseModel
|
||||
'class'=>'fa fa fa-ioxhost',
|
||||
],
|
||||
[
|
||||
'name'=>'新增商品',
|
||||
'name'=>'商品总数',
|
||||
'field'=>'件',
|
||||
'count'=>self::setWhereType(self::getModelTime($where,new self),$type)->where('is_new',1)->sum('stock'),
|
||||
'content'=>'新增商品总数',
|
||||
'count'=>self::setWhereType(self::getModelTime($where,new self),$type)->sum('stock'),
|
||||
'content'=>'增商品总数',
|
||||
'background_color'=>'layui-bg-cyan',
|
||||
'sum'=>self::where('is_new',1)->sum('stock'),
|
||||
'class'=>'fa fa-line-chart',
|
||||
|
||||
@ -67,6 +67,7 @@ class SystemAdmin extends BaseModel
|
||||
{
|
||||
Session::set('adminId',$adminInfo['id']);
|
||||
Session::set('adminInfo',$adminInfo->toArray());
|
||||
Session::save();
|
||||
}
|
||||
|
||||
/**
|
||||
@ -76,7 +77,7 @@ class SystemAdmin extends BaseModel
|
||||
{
|
||||
Session::delete('adminInfo');
|
||||
Session::delete('adminId');
|
||||
Session::clear();
|
||||
Session::save();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -105,7 +105,7 @@ class WechatQrcode extends BaseModel
|
||||
self::createForeverQrcode($id, $type);
|
||||
$res = self::getForeverQrcode($type, $id);
|
||||
}
|
||||
if(!$res['ticket']) exception('临时二维码获取错误');
|
||||
if(!$res['ticket']) exception('永久二维码获取错误');
|
||||
return $res;
|
||||
}
|
||||
|
||||
|
||||
@ -9,7 +9,6 @@ namespace app\admin\model\wechat;
|
||||
use app\admin\model\system\SystemConfig;
|
||||
use crmeb\traits\ModelTrait;
|
||||
use crmeb\basic\BaseModel;
|
||||
use crmeb\services\HookService;
|
||||
use crmeb\services\UtilService;
|
||||
use crmeb\services\WechatService;
|
||||
use think\facade\Route as Url;
|
||||
|
||||
@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
namespace app\api\controller;
|
||||
|
||||
use app\admin\model\system\SystemAttachment;
|
||||
@ -8,6 +9,7 @@ use app\models\store\StoreProduct;
|
||||
use app\models\store\StoreService;
|
||||
use app\models\system\Express;
|
||||
use app\models\user\UserBill;
|
||||
use app\models\user\WechatUser;
|
||||
use app\Request;
|
||||
use crmeb\services\GroupDataService;
|
||||
use crmeb\services\SystemConfigService;
|
||||
@ -56,7 +58,8 @@ class PublicController
|
||||
$lovely = GroupDataService::getData('routine_home_new_banner') ?: [];//TODO 首发新品顶部图
|
||||
$likeInfo = StoreProduct::getHotProduct('id,image,store_name,cate_id,price,unit_name', 3);//TODO 热门榜单 猜你喜欢
|
||||
$couponList = StoreCouponIssue::getIssueCouponList($request->uid(), 3);
|
||||
return app('json')->successful(compact('banner', 'menus', 'roll', 'info', 'activity', 'lovely', 'benefit', 'likeInfo', 'logoUrl', 'couponList','site_name'));
|
||||
$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'));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -137,7 +140,7 @@ class PublicController
|
||||
], $request);
|
||||
if (!$data['filename']) return app('json')->fail('参数有误');
|
||||
if (Cache::has('start_uploads_' . $request->uid()) && Cache::get('start_uploads_' . $request->uid()) >= 100) return app('json')->fail('非法操作');
|
||||
$res = UploadService::getInstance()->setUploadPath('store/comment')->image($data['filename']);
|
||||
$res = UploadService::instance()->setUploadPath('store/comment')->image($data['filename']);
|
||||
if (!is_array($res)) return app('json')->fail($res);
|
||||
SystemAttachment::attachmentAdd($res['name'], $res['size'], $res['type'], $res['dir'], $res['thumb_path'], 1, $res['image_type'], $res['time'], 2);
|
||||
if (Cache::has('start_uploads_' . $request->uid()))
|
||||
@ -190,7 +193,8 @@ class PublicController
|
||||
* @param Request $request
|
||||
* @return mixed
|
||||
*/
|
||||
public function user_share(Request $request){
|
||||
public function user_share(Request $request)
|
||||
{
|
||||
return app('json')->successful(UserBill::setUserShare($request->uid()));
|
||||
}
|
||||
|
||||
@ -199,7 +203,8 @@ class PublicController
|
||||
* @param Request $request
|
||||
* @return mixed
|
||||
*/
|
||||
public function get_image_base64(Request $request){
|
||||
public function get_image_base64(Request $request)
|
||||
{
|
||||
list($imageUrl, $codeUrl) = UtilService::postMore([
|
||||
['image', ''],
|
||||
['code', ''],
|
||||
@ -214,6 +219,4 @@ class PublicController
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
@ -314,7 +314,7 @@ class StoreBargainController
|
||||
if($user['is_promoter'] || sysConfig('store_brokerage_statu') == 2) $valueData.='&pid='.$user['uid'];
|
||||
$res = RoutineCode::getPageCode('pages/activity/goods_bargain_details/index',$valueData,280);
|
||||
if(!$res) return app('json')->fail('二维码生成失败');
|
||||
$imageInfo = UploadService::getInstance()->setUploadPath('routine/activity/bargain/code')->imageStream($name,$res);
|
||||
$imageInfo = UploadService::instance()->setUploadPath('routine/activity/bargain/code')->imageStream($name,$res);
|
||||
if(!is_array($imageInfo)) return app('json')->fail($imageInfo);
|
||||
if($imageInfo['image_type'] == 1) $remoteImage = UtilService::remoteImage($siteUrl.$imageInfo['dir']);
|
||||
else $remoteImage = UtilService::remoteImage($imageInfo['dir']);
|
||||
|
||||
@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
namespace app\api\controller\activity;
|
||||
|
||||
use app\admin\model\system\SystemAttachment;
|
||||
@ -7,6 +8,7 @@ use app\models\store\StoreCombination;
|
||||
use app\models\store\StorePink;
|
||||
use app\models\store\StoreProductReply;
|
||||
use app\Request;
|
||||
use crmeb\services\QrcodeService;
|
||||
use crmeb\services\SystemConfigService;
|
||||
use crmeb\services\UploadService;
|
||||
use crmeb\services\UtilService;
|
||||
@ -48,26 +50,10 @@ class StoreCombinationController
|
||||
$combinationOne = $combinationOne->hidden(['mer_id', 'attr', 'sort', 'add_time', 'is_host', 'is_show', 'is_del', 'mer_use', 'cost', 'combination'])->toArray();
|
||||
$combinationOne['images'] = json_decode($combinationOne['images'], true);
|
||||
list($pink, $pindAll) = StorePink::getPinkAll($id, true);//拼团列表
|
||||
//公众号
|
||||
$name = $id.'_combination_detail_wap.jpg';
|
||||
$imageInfo = SystemAttachment::getInfo($name,'name');
|
||||
$siteUrl = sysConfig('site_url');
|
||||
if(!$imageInfo){
|
||||
$codeUrl = UtilService::setHttpType($siteUrl.'/activity/group_detail/'.$id, 1);//二维码链接
|
||||
$imageInfo = UtilService::getQRCodePath($codeUrl, $name);
|
||||
if(is_array($imageInfo)){
|
||||
SystemAttachment::attachmentAdd($imageInfo['name'],$imageInfo['size'],$imageInfo['type'],$imageInfo['dir'],$imageInfo['thumb_path'],1,$imageInfo['image_type'],$imageInfo['time'],2);
|
||||
$url = $imageInfo['dir'];
|
||||
}else {
|
||||
$url = '';
|
||||
$imageInfo = ['image_type'=>0];
|
||||
}
|
||||
}else $url = $imageInfo['att_dir'];
|
||||
if($imageInfo['image_type'] == 1)
|
||||
$url = $siteUrl.$url;
|
||||
$combinationOne['image'] = UtilService::setSiteUrl($combinationOne['image'], $siteUrl);
|
||||
$combinationOne['image_base'] = UtilService::setSiteUrl($combinationOne['image'], $siteUrl);
|
||||
$combinationOne['code_base'] = $url;
|
||||
$combinationOne['code_base'] = QrcodeService::getWechatQrcodePath($id . '_combination_detail_wap.jpg', '/activity/group_detail/' . $id);
|
||||
$combinationOne['sale_stock'] = 0;
|
||||
if ($combinationOne['stock'] > 0) $combinationOne['sale_stock'] = 1;
|
||||
if (!strlen(trim($combinationOne['unit_name']))) $combinationOne['unit_name'] = '个';
|
||||
@ -204,7 +190,7 @@ class StoreCombinationController
|
||||
if ($user['is_promoter'] || sysConfig('store_brokerage_statu') == 2) $valueData .= '&pid=' . $user['uid'];
|
||||
$res = RoutineCode::getPageCode('pages/activity/goods_combination_status/index', $valueData, 280);
|
||||
if (!$res) return app('json')->fail('二维码生成失败');
|
||||
$imageInfo = UploadService::getInstance()->setUploadPath('routine/activity/pink/code')->imageStream($name,$res);
|
||||
$imageInfo = UploadService::instance()->setUploadPath('routine/activity/pink/code')->imageStream($name, $res);
|
||||
if (!is_array($imageInfo)) return app('json')->fail($imageInfo);
|
||||
if ($imageInfo['image_type'] == 1) $remoteImage = UtilService::remoteImage($siteUrl . $imageInfo['dir']);
|
||||
else $remoteImage = UtilService::remoteImage($imageInfo['dir']);
|
||||
|
||||
@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
namespace app\api\controller\activity;
|
||||
|
||||
use app\admin\model\system\SystemAttachment;
|
||||
@ -7,6 +8,7 @@ use app\models\store\StoreProductReply;
|
||||
use app\models\store\StoreSeckill;
|
||||
use app\Request;
|
||||
use crmeb\services\GroupDataService;
|
||||
use crmeb\services\QrcodeService;
|
||||
use crmeb\services\SystemConfigService;
|
||||
use crmeb\services\UtilService;
|
||||
|
||||
@ -103,29 +105,14 @@ class StoreSeckillController
|
||||
* @param $id
|
||||
* @return mixed
|
||||
*/
|
||||
public function detail(Request $request, $id,$time = 0){
|
||||
public function detail(Request $request, $id, $time = 0)
|
||||
{
|
||||
if (!$id || !($storeInfo = StoreSeckill::getValidProduct($id))) return app('json')->fail('商品不存在或已下架!');
|
||||
$storeInfo = $storeInfo->hidden(['cost', 'add_time', 'is_del'])->toArray();
|
||||
|
||||
//公众号
|
||||
$name = $id.'_seckill_detail_wap.jpg';
|
||||
$imageInfo = SystemAttachment::getInfo($name,'name');
|
||||
$siteUrl = sysConfig('site_url');
|
||||
if(!$imageInfo){
|
||||
$codeUrl = UtilService::setHttpType($siteUrl.'/activity/seckill_detail/'.$id.'/'.$time, 1);//二维码链接
|
||||
$imageInfo = UtilService::getQRCodePath($codeUrl, $name);
|
||||
if(is_array($imageInfo)){
|
||||
SystemAttachment::attachmentAdd($imageInfo['name'],$imageInfo['size'],$imageInfo['type'],$imageInfo['dir'],$imageInfo['thumb_path'],1,$imageInfo['image_type'],$imageInfo['time'],2);
|
||||
$url = $imageInfo['dir'];
|
||||
}else {
|
||||
$url = '';
|
||||
$imageInfo = ['image_type'=>0];
|
||||
}
|
||||
}else $url = $imageInfo['att_dir'];
|
||||
if($imageInfo['image_type'] == 1) $url = $siteUrl.$url;
|
||||
$storeInfo['image'] = UtilService::setSiteUrl($storeInfo['image'], $siteUrl);
|
||||
$storeInfo['image_base'] = UtilService::setSiteUrl($storeInfo['image'], $siteUrl);
|
||||
$storeInfo['code_base'] = $url;
|
||||
$storeInfo['code_base'] = QrcodeService::getWechatQrcodePath($id . '_seckill_detail_wap.jpg', '/activity/seckill_detail/' . $id . '/' . $time);
|
||||
$uid = $request->uid();
|
||||
$storeInfo['userLike'] = StoreProductRelation::isProductRelation($id, $uid, 'like', 'product_seckill');
|
||||
$storeInfo['like_num'] = StoreProductRelation::productRelationNum($id, 'like', 'product_seckill');
|
||||
|
||||
@ -516,7 +516,7 @@ class StoreOrderController
|
||||
else if($cartInfo['cart_info']['seckill_id']) $productId = $cartInfo['cart_info']['product_id'];
|
||||
else if($cartInfo['cart_info']['bargain_id']) $productId = $cartInfo['cart_info']['product_id'];
|
||||
else $productId = $cartInfo['product_id'];
|
||||
if($group['pics']) $group['pics'] = json_encode(explode(',',$group['pics']));
|
||||
if($group['pics']) $group['pics'] = json_encode(is_array($group['pics']) ? $group['pics']: explode(',',$group['pics']));
|
||||
$group = array_merge($group,[
|
||||
'uid'=>$uid,
|
||||
'oid'=>$cartInfo['oid'],
|
||||
|
||||
@ -22,8 +22,8 @@ class ArticleController
|
||||
public function lst(Request $request, $cid)
|
||||
{
|
||||
list($page, $limit) = UtilService::getMore([
|
||||
['page',0],
|
||||
['limit',0],
|
||||
['page',1],
|
||||
['limit',10],
|
||||
],$request, true);
|
||||
$list = Article::cidByArticleList($cid,$page,$limit,"id,title,image_input,visit,from_unixtime(add_time,'%Y-%m-%d %H:%i') as add_time,synopsis,url") ?? [];
|
||||
if(is_object($list)) $list = $list->toArray();
|
||||
|
||||
@ -9,7 +9,7 @@ class CategoryController
|
||||
{
|
||||
public function category(Request $request)
|
||||
{
|
||||
$cateogry = StoreCategory::with('children')->where('is_show',1)->where('pid',0)->select();
|
||||
$cateogry = StoreCategory::with('children')->where('is_show',1)->order('sort desc,id desc')->where('pid',0)->select();
|
||||
return app('json')->success($cateogry->hidden(['add_time','is_show','sort','children.sort','children.add_time','children.pid','children.is_show'])->toArray());
|
||||
}
|
||||
}
|
||||
@ -10,6 +10,7 @@ use app\models\store\StoreProductRelation;
|
||||
use app\models\store\StoreProductReply;
|
||||
use app\Request;
|
||||
use crmeb\services\GroupDataService;
|
||||
use crmeb\services\QrcodeService;
|
||||
use crmeb\services\SystemConfigService;
|
||||
use crmeb\services\UtilService;
|
||||
|
||||
@ -46,10 +47,6 @@ class StoreProductController
|
||||
* @param Request $request
|
||||
* @param $id
|
||||
* @return mixed
|
||||
* @throws \think\Exception
|
||||
* @throws \think\db\exception\DataNotFoundException
|
||||
* @throws \think\db\exception\ModelNotFoundException
|
||||
* @throws \think\exception\DbException
|
||||
*/
|
||||
public function code(Request $request, $id)
|
||||
{
|
||||
@ -61,16 +58,10 @@ class StoreProductController
|
||||
case 'wechat':
|
||||
//公众号
|
||||
$name = $id . '_product_detail_' . $user['uid'] . '_is_promoter_' . $user['is_promoter'] . '_wap.jpg';
|
||||
$imageInfo = SystemAttachment::getInfo($name,'name');
|
||||
$siteUrl = sysConfig('site_url');
|
||||
if(!$imageInfo){
|
||||
$codeUrl = UtilService::setHttpType($siteUrl.'/detail/'.$id.'?spread='.$user['uid'], 1);//二维码链接
|
||||
$imageInfo = UtilService::getQRCodePath($codeUrl, $name);
|
||||
if(is_string($imageInfo)) return app('json')->fail('二维码生成失败');
|
||||
SystemAttachment::attachmentAdd($imageInfo['name'],$imageInfo['size'],$imageInfo['type'],$imageInfo['dir'],$imageInfo['thumb_path'],1,$imageInfo['image_type'],$imageInfo['time'],2);
|
||||
$url = $imageInfo['dir'];
|
||||
}else $url = $imageInfo['att_dir'];
|
||||
if($imageInfo['image_type'] == 1) $url = $siteUrl.$url;
|
||||
$url = QrcodeService::getWechatQrcodePath($name, '/detail/' . $id . '?spread=' . $user['uid']);
|
||||
if ($url === false)
|
||||
return app('json')->fail('二维码生成失败');
|
||||
else
|
||||
return app('json')->successful(['code' => UtilService::setImageBase64($url)]);
|
||||
break;
|
||||
case 'routine':
|
||||
@ -83,7 +74,7 @@ class StoreProductController
|
||||
if ($user['is_promoter'] || sysConfig('store_brokerage_statu') == 2) $data .= '&pid=' . $user['uid'];
|
||||
$res = \app\models\routine\RoutineCode::getPageCode('pages/goods_details/index', $data, 280);
|
||||
if (!$res) return app('json')->fail('二维码生成失败');
|
||||
$imageInfo = \crmeb\services\UploadService::getInstance()->setUploadPath('routine/product')->imageStream($name,$res);
|
||||
$imageInfo = \crmeb\services\UploadService::instance()->setUploadPath('routine/product')->imageStream($name, $res);
|
||||
if (is_string($imageInfo)) return app('json')->fail($imageInfo);
|
||||
if ($imageInfo['image_type'] == 1) $remoteImage = UtilService::remoteImage($siteUrl . $imageInfo['dir']);
|
||||
else $remoteImage = UtilService::remoteImage($imageInfo['dir']);
|
||||
@ -103,29 +94,20 @@ class StoreProductController
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 产品详情
|
||||
* @param Request $request
|
||||
* @param $id
|
||||
* @param int $type
|
||||
* @return mixed
|
||||
*/
|
||||
public function detail(Request $request, $id, $type = 0)
|
||||
{
|
||||
if (!$id || !($storeInfo = StoreProduct::getValidProduct($id))) return app('json')->fail('商品不存在或已下架');
|
||||
|
||||
//公众号
|
||||
$name = $id.'_product_detail_wap.jpg';
|
||||
$imageInfo = SystemAttachment::getInfo($name,'name');
|
||||
$siteUrl = sysConfig('site_url');
|
||||
if(!$imageInfo){
|
||||
$codeUrl = UtilService::setHttpType($siteUrl.'/detail/'.$id, 1);//二维码链接
|
||||
$imageInfo = UtilService::getQRCodePath($codeUrl, $name);
|
||||
if(is_array($imageInfo)){
|
||||
SystemAttachment::attachmentAdd($imageInfo['name'],$imageInfo['size'],$imageInfo['type'],$imageInfo['dir'],$imageInfo['thumb_path'],1,$imageInfo['image_type'],$imageInfo['time'],2);
|
||||
$url = $imageInfo['dir'];
|
||||
}else {
|
||||
$url = '';
|
||||
$imageInfo = ['image_type'=>0];
|
||||
}
|
||||
}else $url = $imageInfo['att_dir'];
|
||||
if($imageInfo['image_type'] == 1) $url = $siteUrl.$url;
|
||||
$storeInfo['image'] = UtilService::setSiteUrl($storeInfo['image'], $siteUrl);
|
||||
$storeInfo['image_base'] = UtilService::setSiteUrl($storeInfo['image'], $siteUrl);
|
||||
$storeInfo['code_base'] = $url;
|
||||
$storeInfo['code_base'] = QrcodeService::getWechatQrcodePath($id . '_product_detail_wap.jpg', '/detail/' . $id);
|
||||
$uid = $request->uid();
|
||||
$data['uid'] = $uid;
|
||||
//替换windows服务器下正反斜杠问题导致图片无法显示
|
||||
@ -167,6 +149,7 @@ class StoreProductController
|
||||
$data['system_store'] = ($res = SystemStore::getStoreDispose()) ? $res : [];
|
||||
$data['good_list'] = StoreProduct::getGoodList(18, 'image,store_name,price,id,ot_price');
|
||||
$data['mapKey'] = sysConfig('tengxun_map_key');
|
||||
$data['store_self_mention'] = (int)sysConfig('store_self_mention') ?? 0;//门店自提是否开启
|
||||
return app('json')->successful($data);
|
||||
}
|
||||
|
||||
@ -229,6 +212,7 @@ class StoreProductController
|
||||
if (!$id || !is_numeric($id)) return app('json')->fail('参数错误!');
|
||||
return app('json')->successful(StoreProductReply::productReplyCount($id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取产品评论
|
||||
* @param Request $request
|
||||
|
||||
@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
namespace app\api\controller\user;
|
||||
|
||||
use app\admin\model\system\SystemAttachment;
|
||||
@ -166,7 +167,7 @@ class UserBillController
|
||||
if (!$imageInfo) {
|
||||
$res = RoutineCode::getShareCode($user['uid'], 'spread', '', '');
|
||||
if (!$res) return app('json')->fail('二维码生成失败');
|
||||
$imageInfo = UploadService::getInstance()->setUploadPath('routine/spread/code')->imageStream($name,$res['res']);
|
||||
$imageInfo = UploadService::instance()->setUploadPath('routine/spread/code')->imageStream($name, $res['res']);
|
||||
if (!is_array($imageInfo)) return app('json')->fail($imageInfo);
|
||||
SystemAttachment::attachmentAdd($imageInfo['name'], $imageInfo['size'], $imageInfo['type'], $imageInfo['dir'], $imageInfo['thumb_path'], 1, $imageInfo['image_type'], $imageInfo['time'], 2);
|
||||
RoutineQrcode::setRoutineQrcodeFind($res['id'], ['status' => 1, 'time' => time(), 'qrcode_url' => $imageInfo['dir']]);
|
||||
|
||||
@ -8,6 +8,7 @@ use app\models\user\User;
|
||||
use app\models\user\UserToken;
|
||||
use app\models\user\WechatUser;
|
||||
use app\Request;
|
||||
use crmeb\utils\Canvas;
|
||||
use crmeb\services\WechatService;
|
||||
use think\facade\Cookie;
|
||||
|
||||
@ -91,4 +92,27 @@ class WechatController
|
||||
} else
|
||||
return app('json')->fail('登录失败');
|
||||
}
|
||||
|
||||
public function follow()
|
||||
{
|
||||
$canvas = Canvas::instance();
|
||||
$path = 'uploads/follow/';
|
||||
$imageType = 'jpg';
|
||||
$name = 'follow';
|
||||
$siteUrl = sysConfig('site_url');
|
||||
if (file_exists($path . $name . '.' . $imageType)) {
|
||||
return app('json')->success('ok', ['path' => $siteUrl . '/' . $path . $name . '.' . $imageType]);
|
||||
}
|
||||
$canvas->setImageUrl('static/qrcode/follow.png')->setImageHeight(720)->setImageWidth(500)->pushImageValue();
|
||||
$wechatQrcode = sysConfig('wechat_qrcode');
|
||||
if (($strlen = stripos($wechatQrcode, 'uploads')) !== false) {
|
||||
$wechatQrcode = substr($wechatQrcode, $strlen);
|
||||
}
|
||||
if (!$wechatQrcode)
|
||||
return app('json')->fail('请上传二维码');
|
||||
$canvas->setImageUrl($wechatQrcode)->setImageHeight(344)->setImageWidth(344)->setImageLeft(76)->setImageTop(76)->pushImageValue();
|
||||
$image = $canvas->setFileName($name)->setImageType($imageType)->setPath($path)->setBackgroundWidth(500)->setBackgroundHeight(720)->starDrawChart();
|
||||
return app('json')->success('ok', ['path' => $image ? $siteUrl . '/' . $image : '']);
|
||||
}
|
||||
|
||||
}
|
||||
@ -335,7 +335,7 @@ class StoreOrder extends BaseModel
|
||||
}
|
||||
$orderInfo = [
|
||||
'uid' => $uid,
|
||||
'order_id' => $test ? 0 : self::getNewOrderId($uid),
|
||||
'order_id' => $test ? 0 : self::getNewOrderId(),
|
||||
'real_name' => $addressInfo['real_name'],
|
||||
'user_phone' => $addressInfo['phone'],
|
||||
'user_address' => $addressInfo['province'] . ' ' . $addressInfo['city'] . ' ' . $addressInfo['district'] . ' ' . $addressInfo['detail'],
|
||||
@ -490,10 +490,10 @@ class StoreOrder extends BaseModel
|
||||
* @param $uid 用户uid
|
||||
* @return string
|
||||
*/
|
||||
public static function getNewOrderId($uid)
|
||||
public static function getNewOrderId()
|
||||
{
|
||||
list($msec, $sec) = explode(' ', microtime());
|
||||
$msectime = (float)sprintf('%.0f', (floatval($msec) + floatval($sec)) * 1000);
|
||||
$msectime = number_format((floatval($msec) + floatval($sec)) * 1000,0,'','');
|
||||
$orderId = 'wx' . $msectime . mt_rand(10000,99999);
|
||||
if(self::be(['order_id'=>$orderId])) $orderId = 'wx' . $msectime . mt_rand(10000,99999);
|
||||
return $orderId;
|
||||
|
||||
@ -40,7 +40,8 @@ class WechatUser extends BaseModel
|
||||
* @param string $uid
|
||||
* @return bool|mixed
|
||||
*/
|
||||
public static function getOpenId($uid = ''){
|
||||
public static function getOpenId($uid = '')
|
||||
{
|
||||
if ($uid == '') return false;
|
||||
return self::where('uid', $uid)->value('routine_openid');
|
||||
}
|
||||
@ -75,7 +76,8 @@ class WechatUser extends BaseModel
|
||||
* @param $routineInfo
|
||||
* @return mixed
|
||||
*/
|
||||
public static function routineOauth($routine){
|
||||
public static function routineOauth($routine)
|
||||
{
|
||||
$routineInfo['nickname'] = filterEmoji($routine['nickName']);//姓名
|
||||
$routineInfo['sex'] = $routine['gender'];//性别
|
||||
$routineInfo['language'] = $routine['language'];//语言
|
||||
@ -120,12 +122,14 @@ class WechatUser extends BaseModel
|
||||
}
|
||||
return $uid;
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断是否是小程序用户
|
||||
* @param int $uid
|
||||
* @return bool|int|string
|
||||
*/
|
||||
public static function isRoutineUser($uid = 0){
|
||||
public static function isRoutineUser($uid = 0)
|
||||
{
|
||||
if (!$uid) return false;
|
||||
return self::where('uid', $uid)->where('user_type', 'routine')->count();
|
||||
}
|
||||
@ -134,7 +138,8 @@ class WechatUser extends BaseModel
|
||||
* @param int $uid
|
||||
* @return int
|
||||
*/
|
||||
public static function isUserStatus($uid = 0){
|
||||
public static function isUserStatus($uid = 0)
|
||||
{
|
||||
if (!$uid) return 0;
|
||||
$user = User::getUserInfo($uid);
|
||||
return $user['status'];
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user