作者 Cool
1 个管道 的构建 通过 耗费 1 秒

后台商品管理优化

... ... @@ -2,6 +2,8 @@
namespace app\admin\controller;
use app\admin\model\AuthGroupAccess;
use app\api\model\Store;
use app\common\controller\Backend;
use app\admin\model\Litestorespec as SpecModel;
use app\admin\model\Litestorespecvalue as SpecValueModel;
... ... @@ -19,6 +21,8 @@ class Litestoregoods extends Backend
* @var \app\admin\model\Litestoregoods
*/
protected $model = null;
protected $dataLimit = true;
protected $dataLimitField = 'store_id';
public function _initialize()
{
... ... @@ -34,6 +38,17 @@ class Litestoregoods extends Backend
$this->view->assign("spec_attr", '');
$this->view->assign("spec_list", '');
$auth_group = new AuthGroupAccess();
$admin_id = session('admin.id');
$group_id = $auth_group->where(['uid'=>$admin_id,'group_id'=>1])->count();
$store = '';
if($group_id == 1) {
$store_model = new Store();
$store = $store_model->where('status',3)->select();
}
$this->view->assign('admin_id',$admin_id);
$this->view->assign('store',$store);
$this->view->assign('group_id',$group_id);
}
/**
... ...
... ... @@ -3,6 +3,7 @@
return [
'Goods_id' => 'ID',
'Goods_name' => '商品名称',
'Store_id' => '商家',
'Category_id' => '商品类别',
'Images' => '商品图片',
'Spec_type' => '商品规格',
... ...
<form id="add-form" class="form-horizontal" role="form" data-toggle="validator" method="POST" action="">
{eq name="group_id" value="1"}
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Store_id')}:</label>
<div class="col-xs-12 col-sm-8">
<select name="row[store_id]" id="" data-rule="required" class="form-control">
<option value="">选择商家</option>
{foreach name="store" item="vo"}
<option value="{vo.admin_id}">{$vo.store_name}</option>
{/foreach}
</select>
</div>
</div>
{else}
<input type="hidden" name="row[store_id]" value="{$admin_id}">
{/eq}
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Goods_name')}:</label>
<div class="col-xs-12 col-sm-8">
... ...
<form id="edit-form" class="form-horizontal" role="form" data-toggle="validator" method="POST" action="">
{eq name="group_id" value="1"}
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Store_id')}:</label>
<div class="col-xs-12 col-sm-8">
<select name="row[store_id]" id="" data-rule="required" class="form-control">
{foreach name="store" item="vo"}
<option value="{vo.admin_id}" {eq name="vo.admin_id" value="$row.store_id"}selected{/eq}>{$vo.store_name}</option>
{/foreach}
</select>
</div>
</div>
{/eq}
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Goods_name')}:</label>
<div class="col-xs-12 col-sm-8">
... ...
<form id="edit-form" class="form-horizontal" role="form" data-toggle="validator" method="POST" action="">
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Status')}:</label>
<div class="col-xs-12 col-sm-8">
{:build_radios('row[status]', ['2'=>__('Status 2'), '3'=>__('Status 3')])}
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Username')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-mobile" data-rule="required" class="form-control" name="row[mobile]" type="text" value="{$row.mobile|htmlentities}">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Admin.nickname')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-nickname" data-rule="required" class="form-control" name="row[nickname]" type="text" value="">
</div>
</div>
<div class="form-group">
<label for="password" class="control-label col-xs-12 col-sm-2">{:__('Password')}:</label>
<div class="col-xs-12 col-sm-8">
<input type="password" class="form-control" id="password" name="row[password]" autocomplete="new-password" value="" data-rule="required;password" />
</div>
</div>
<div class="form-group layer-footer">
<label class="control-label col-xs-12 col-sm-2"></label>
<div class="col-xs-12 col-sm-8">
<button type="submit" class="btn btn-success btn-embossed disabled">{:__('OK')}</button>
<button type="reset" class="btn btn-default btn-embossed">{:__('Reset')}</button>
</div>
</div>
</form>
... ...
... ... @@ -123,32 +123,33 @@ class Store extends Api
$param = (new StoreValidate())->goCheck('store_add');
$order_sn = $param['order_sn'] = get_order_sn();
$pay_data = [];
if($this->auth->end_time > time()) {
$param['status'] = 2;
} else {
// if($this->auth->end_time > time()) {
// $param['status'] = 2;
// } else {
$param['status'] = 1;
// 获取小程序配置
$options = \config('miniprogram.basic');
$app = new Application($options);
$payment = $app->payment;
// 获取支付参数
$attributes = [
'body' => '发布招募合伙人',
'out_trade_no' => $order_sn,
'total_fee' => 1, // $param['money'] * 100
'spbill_create_ip' => request()->ip(), // 可选,如不传该参数,SDK 将会自动获取相应 IP 地址
'notify_url' => url('index/ajax/notify',[],true,true), // 支付结果通知网址,如果不设置则会使用配置里的默认地址
'trade_type' => 'JSAPI', // 请对应换成你的支付方式对应的值类型
'openid' => Db::name('third')->where('user_id',$this->auth->id)->value('openid'),
];
$order = new Order($attributes);
$order_result = $payment->pay($order);
if($order_result['return_code'] == 'SUCCESS' && $order_result['result_code'] == 'SUCCESS') {
$prepayId = $order_result->prepay_id;
} else {
$this->error($order_result['return_msg']);
}
}
// // 获取小程序配置
// $options = \config('miniprogram.basic');
// $app = new Application($options);
// $payment = $app->payment;
// // 获取支付参数
// $attributes = [
// 'body' => '发布招募合伙人',
// 'out_trade_no' => $order_sn,
// 'total_fee' => 1, // $param['money'] * 100
// 'spbill_create_ip' => request()->ip(), // 可选,如不传该参数,SDK 将会自动获取相应 IP 地址
// 'notify_url' => url('index/ajax/notify',[],true,true), // 支付结果通知网址,如果不设置则会使用配置里的默认地址
// 'trade_type' => 'JSAPI', // 请对应换成你的支付方式对应的值类型
// 'openid' => Db::name('third')->where('user_id',$this->auth->id)->value('openid'),
// ];
// $order = new Order($attributes);
// $order_result = $payment->pay($order);
// if($order_result['return_code'] == 'SUCCESS' && $order_result['result_code'] == 'SUCCESS') {
// $prepayId = $order_result->prepay_id;
// $pay_data = $payment->configForJSSDKPayment($prepayId);
// } else {
// $this->error($order_result['return_msg']);
// }
// }
Db::startTrans();
$result = false;
$result_invite = true;
... ...