This commit is contained in:
mkm 2024-06-26 16:50:40 +08:00
commit dba7e7ec8c
3 changed files with 66 additions and 2 deletions

View File

@ -4,6 +4,7 @@ namespace app\admin\lists\store_product;
use app\admin\lists\BaseAdminDataLists;
use app\common\model\cate\Cate;
use app\common\model\store_product\StoreProduct;
use app\common\lists\ListsSearchInterface;
use app\common\model\store_category\StoreCategory;
@ -45,6 +46,17 @@ class StoreProductLists extends BaseAdminDataLists implements ListsSearchInterfa
*/
public function lists(): array
{
$class_all = $this->request->get('class_all');
if ($class_all) {
//查3级别的
$arr = Cate::where('pid', $class_all)->column('id');
if ($arr) {
$arr2 = Cate::where('pid', 'in', $arr)->column('id');
$this->searchWhere[] = ['cate_id', 'in', array_merge($arr, $arr2)];
} else {
$this->searchWhere[] = ['cate_id', '=', $class_all];
}
}
return StoreProduct::where($this->searchWhere)
->field(['id', 'image', 'store_name','swap', 'cate_id','batch', 'price','vip_price','sales', 'stock', 'is_show', 'unit', 'cost','rose','purchase','bar_code','manufacturer_information'])
->limit($this->limitOffset, $this->limitLength)

View File

@ -14,6 +14,8 @@ use app\common\service\PushService;
use app\common\service\wechat\WechatTemplate;
use app\statistics\logic\OrderLogic;
use Exception;
use Overtrue\EasySms\EasySms;
use Overtrue\EasySms\Exceptions\NoGatewayAvailableException;
use support\Cache;
use think\facade\Db;
use Webman\Config;
@ -29,7 +31,56 @@ class IndexController extends BaseApiController
public $notNeedLogin = ['index', 'app_update', 'express_list', 'province', 'city', 'area', 'street', 'village', 'brigade', 'config'];
public function index()
{ $all_where['paid'] = 1;
{
$config = [
// HTTP 请求的超时时间(秒)
'timeout' => 5.0,
// 默认发送配置
'default' => [
// 网关调用策略,默认:顺序调用
'strategy' => \Overtrue\EasySms\Strategies\OrderStrategy::class,
// 默认可用的发送网关
'gateways' => [
'yunpian', 'aliyun',
],
],
// 可用的网关配置
'gateways' => [
'errorlog' => [
'file' => runtime_path() . '/logs/' . date('Ymd') . '/easy-sms.log',
],
'aliyun' => [
'access_key_id' => 'LTAI5t7mhH3ij2cNWs1zhPmv',
'access_key_secret' => 'gqo2wMpvi8h5bDBmCpMje6BaiXvcPu',
'sign_name' => '里海科技',
],
//...
],
];
try {
$easySms = new EasySms($config);
$template = getenv('SMS_TEMPLATE');
$a = $easySms->send(18715753257, [
'content' => '您的验证码为: 6379',
'template' => $template,
'data' => [
'code' => 6379
],
]);
// d($a);
}catch (NoGatewayAvailableException $exception){
throw new \Exception($exception->getExceptions());
}
d($a,getenv('SMS_TEMPLATE'));
$all_where['paid'] = 1;
d(OrderLogic::dayPayPrice($all_where,date('Y-m-d',time())));
$uid=9;
$a= PushService::push('wechat_mmp_'.$uid, $uid, ['type'=>'INDUSTRYMEMBERS','msg'=>'支付超时,订单已被取消,请重新提交订单','data'=>['id'=>5]]);

View File

@ -75,7 +75,8 @@ class SmsService
return false;
}
}catch(NoGatewayAvailableException $e){
throw new BusinessException($e->getMessage());
d($e);
throw new BusinessException($e->getExceptions());
}
}