更新
This commit is contained in:
parent
54d5b3ae56
commit
5e34932dc3
@ -4,15 +4,15 @@ namespace app\admin\controller\merchat;
|
||||
|
||||
|
||||
use app\admin\controller\BaseAdminController;
|
||||
use app\admin\lists\merchat\MerchantLists;
|
||||
use app\admin\logic\merchat\MerchantLogic;
|
||||
use app\admin\validate\merchat\MerchantValidate;
|
||||
use app\admin\lists\merchant\MerchantLists;
|
||||
use app\admin\logic\merchant\MerchantLogic;
|
||||
use app\admin\validate\merchant\MerchantValidate;
|
||||
|
||||
|
||||
/**
|
||||
* 商户列表控制器
|
||||
* Class MerchantController
|
||||
* @package app\admin\controller\merchat
|
||||
* @package app\admin\controller\merchant
|
||||
*/
|
||||
class MerchantController extends BaseAdminController
|
||||
{
|
||||
|
@ -1,17 +1,17 @@
|
||||
<?php
|
||||
|
||||
namespace app\admin\lists\merchat;
|
||||
namespace app\admin\lists\merchant;
|
||||
|
||||
|
||||
use app\admin\lists\BaseAdminDataLists;
|
||||
use app\common\model\merchat\Merchant;
|
||||
use app\common\model\merchant\Merchant;
|
||||
use app\common\lists\ListsSearchInterface;
|
||||
|
||||
|
||||
/**
|
||||
* 商户列表列表
|
||||
* Class MerchantLists
|
||||
* @package app\admin\listsmerchat
|
||||
* @package app\admin\listsmerchant
|
||||
*/
|
||||
class MerchantLists extends BaseAdminDataLists implements ListsSearchInterface
|
||||
{
|
||||
|
@ -1,9 +1,9 @@
|
||||
<?php
|
||||
|
||||
namespace app\admin\logic\merchat;
|
||||
namespace app\admin\logic\merchant;
|
||||
|
||||
|
||||
use app\common\model\merchat\Merchant;
|
||||
use app\common\model\merchant\Merchant;
|
||||
use app\common\logic\BaseLogic;
|
||||
use think\facade\Db;
|
||||
|
||||
@ -11,7 +11,7 @@ use think\facade\Db;
|
||||
/**
|
||||
* 商户列表逻辑
|
||||
* Class MerchantLogic
|
||||
* @package app\admin\logic\merchat
|
||||
* @package app\admin\logic\merchant
|
||||
*/
|
||||
class MerchantLogic extends BaseLogic
|
||||
{
|
@ -6,6 +6,7 @@ namespace app\admin\logic\retail;
|
||||
use app\common\model\retail\Cashierclass;
|
||||
use app\common\logic\BaseLogic;
|
||||
use app\common\model\goods\Unit;
|
||||
use app\common\model\merchant\Merchant;
|
||||
use app\common\model\retail\Cashierinfo;
|
||||
use think\facade\Db;
|
||||
|
||||
@ -121,6 +122,8 @@ class CashierclassLogic extends BaseLogic
|
||||
$item['msg']='预计48小时发货';
|
||||
$item['goods_unit']=Unit::where('id',$item['unit'])->value('name');
|
||||
});
|
||||
$find['merchant_info']=Merchant::where('mer_id',$find['merchant'])->field('mer_name,service_phone')->find();
|
||||
|
||||
}
|
||||
return $find->toArray();
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
namespace app\admin\validate\merchat;
|
||||
namespace app\admin\validate\merchant;
|
||||
|
||||
|
||||
use app\common\validate\BaseValidate;
|
||||
@ -9,7 +9,7 @@ use app\common\validate\BaseValidate;
|
||||
/**
|
||||
* 商户列表验证器
|
||||
* Class MerchantValidate
|
||||
* @package app\admin\validate\merchat
|
||||
* @package app\admin\validate\merchant
|
||||
*/
|
||||
class MerchantValidate extends BaseValidate
|
||||
{
|
@ -5,7 +5,7 @@ namespace app\api\lists\merchant;
|
||||
|
||||
use app\admin\lists\BaseAdminDataLists;
|
||||
use app\common\lists\ListsSearchInterface;
|
||||
use app\common\model\merchat\Merchant;
|
||||
use app\common\model\merchant\Merchant;
|
||||
use app\common\model\opurchase\OpurchaseGoodsOffer;
|
||||
use think\facade\Db;
|
||||
|
||||
|
@ -5,12 +5,14 @@ namespace app\api\logic\order;
|
||||
use app\common\logic\BaseLogic;
|
||||
use app\common\model\goods\Goods;
|
||||
use app\common\model\goods\Unit;
|
||||
use app\common\model\merchat\Merchant;
|
||||
use app\common\model\merchant\Merchant;
|
||||
use app\common\model\opurchase\Opurchaseclass;
|
||||
use app\common\model\opurchase\Opurchaseinfo;
|
||||
use app\common\model\order\Cart;
|
||||
use app\common\model\retail\Cashierclass;
|
||||
use app\common\model\retail\Cashierinfo;
|
||||
use app\common\model\user\UserAddress;
|
||||
use app\Request;
|
||||
use think\facade\Db;
|
||||
|
||||
/**
|
||||
@ -69,6 +71,14 @@ class OrderLogic extends BaseLogic
|
||||
static public function createOrder($cartId, $addressId, $user = null, $params = [])
|
||||
{
|
||||
$orderInfo = self::cartIdByOrderInfo($cartId, $addressId, $user, $params);
|
||||
if($addressId>0){
|
||||
$address=UserAddress::where(['id'=>$addressId,'uid'=>Request()->userId])->find();
|
||||
if($address){
|
||||
$_order['real_name'] = $address['real_name'];
|
||||
$_order['user_phone'] = $address['phone'];
|
||||
$_order['user_address'] = $address['detail'];
|
||||
}
|
||||
}
|
||||
$_order = $orderInfo['order'];
|
||||
$_order['deduction_price'] = 0;
|
||||
$_order['merchant'] = $params['mer_id'];
|
||||
|
@ -6,7 +6,7 @@ namespace app\api\service;
|
||||
use app\common\enum\YesNoEnum;
|
||||
use app\common\model\user\{User, UserAuth};
|
||||
use app\common\enum\user\UserTerminalEnum;
|
||||
use app\common\model\merchat\Merchant;
|
||||
use app\common\model\merchant\Merchant;
|
||||
use app\common\model\supplier\Supplier;
|
||||
use app\common\service\{ConfigService, storage\Driver as StorageDriver};
|
||||
use think\Exception;
|
||||
|
2
app/common/cache/UserTokenCache.php
vendored
2
app/common/cache/UserTokenCache.php
vendored
@ -15,7 +15,7 @@
|
||||
|
||||
namespace app\common\cache;
|
||||
|
||||
use app\common\model\merchat\Merchant;
|
||||
use app\common\model\merchant\Merchant;
|
||||
use app\common\model\supplier\Supplier;
|
||||
use app\common\model\user\User;
|
||||
use app\common\model\user\UserSession;
|
||||
|
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
namespace app\common\model\merchat;
|
||||
namespace app\common\model\merchant;
|
||||
|
||||
|
||||
use app\common\model\BaseModel;
|
||||
@ -10,7 +10,7 @@ use think\model\concern\SoftDelete;
|
||||
/**
|
||||
* 商户列表模型
|
||||
* Class Merchant
|
||||
* @package app\common\model\merchat
|
||||
* @package app\common\model\merchant
|
||||
*/
|
||||
class Merchant extends BaseModel
|
||||
{
|
@ -26,9 +26,9 @@ use EasyWeChat\OfficialAccount\Application;
|
||||
class WeChatOaService
|
||||
{
|
||||
|
||||
protected $app;
|
||||
public $app;
|
||||
|
||||
protected $config;
|
||||
public $config;
|
||||
|
||||
|
||||
public function __construct()
|
||||
|
66
app/common/service/wechat/WechatTemplate.php
Normal file
66
app/common/service/wechat/WechatTemplate.php
Normal file
@ -0,0 +1,66 @@
|
||||
<?php
|
||||
namespace app\common\service\wechat;
|
||||
|
||||
use support\exception\BusinessException;
|
||||
|
||||
class WechatTemplate
|
||||
{
|
||||
protected $token;
|
||||
protected $Client;
|
||||
protected $Config;
|
||||
public function __construct()
|
||||
{
|
||||
$this->Client = (new WeChatOaService())->getClient();
|
||||
$this->Config = (new WeChatOaService())->config;
|
||||
$this->token = (new WeChatOaService())->app->getAccessToken()->getToken();
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 新报价通知
|
||||
*/
|
||||
public function NewQuotationNotification($data)
|
||||
{
|
||||
$template = [
|
||||
'touser' => $data['openid'],
|
||||
'template_id' => 'hfvTch-DcP_UQ83VkD6Z-eMimeRrK8P8zpWC9j2dOKc',
|
||||
'miniprogram' => 'data',
|
||||
'appid' => $this->Config['app_id'],
|
||||
'pagepath' => 'pages/index/index',
|
||||
'data' => [
|
||||
'thing2' => ['value' => $data['data1']],
|
||||
'time6' => ['value' => $data['data2']],
|
||||
'thing4' => ['value' => $data['data3']],
|
||||
'phone_number5' => ['value' => $data['data3']],
|
||||
]
|
||||
];
|
||||
return $this->post($template);
|
||||
}
|
||||
/**
|
||||
* @notes 采用通知
|
||||
*/
|
||||
public function AdoptingNotifications($data)
|
||||
{
|
||||
$template = [
|
||||
'touser' => $data['openid'],
|
||||
'template_id' => 'hfvTch-DcP_UQ83VkD6Z-eMimeRrK8P8zpWC9j2dOKc',
|
||||
'miniprogram' => 'data',
|
||||
'appid' => $this->Config['app_id'],
|
||||
'pagepath' => 'pages/index/index',
|
||||
'data' => [
|
||||
'thing2' => ['value' => $data['data1']],
|
||||
'thing3' => ['value' => $data['data2']],
|
||||
'const4' => ['value' => $data['data3']??08302669767],
|
||||
]
|
||||
];
|
||||
return $this->post($template);
|
||||
}
|
||||
protected function post($template)
|
||||
{
|
||||
$url = "https://api.weixin.qq.com/cgi-bin/message/template/send?access_token=" . $this->token;
|
||||
$res = $this->Client->postJson($url, $template)->toArray();
|
||||
if ($res['errmsg'] == 'ok' && $res['errcode'] == 0) {
|
||||
return true;
|
||||
}
|
||||
throw new BusinessException($res['errmsg'], 3000);
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user