增加拉卡拉配置管理,商户管理

This commit is contained in:
qinzexin 2025-08-05 18:31:58 +08:00
parent 82d46ffb48
commit 608e3bcae4
22 changed files with 956 additions and 39 deletions

View File

@ -504,6 +504,7 @@ class Index extends Backend
throw new \Exception("机构或个人认证用户已存在或被其他机构占用,请更改!");
}
}else{
//新增

View File

@ -0,0 +1,222 @@
<?php
namespace app\admin\controller\manystore;
use app\admin\model\manystore\Shop;
use app\admin\model\User;
use app\common\controller\Backend;
use app\manystore\model\Manystore;
use think\Db;
use think\exception\DbException;
use think\exception\PDOException;
use think\exception\ValidateException;
/**
* 拉卡拉商户
*
* @icon fa fa-circle-o
*/
class LakalaBusiness extends Backend
{
protected $qSwitch = true;
protected $qFields = ["shop_id","user_id"];
/**
* LakalaBusiness模型对象
* @var \app\admin\model\manystore\LakalaBusiness
*/
protected $model = null;
public function _initialize()
{
$this->model = new \app\admin\model\manystore\LakalaBusiness;
parent::_initialize();
$this->view->assign("statusList", $this->model->getStatusList());
}
/**
* 默认生成的控制器所继承的父类中有index/add/edit/del/multi五个基础方法、destroy/restore/recyclebin三个回收站方法
* 因此在当前控制器中可不用编写增删改查的代码,除非需要自己控制这部分逻辑
* 需要将application/admin/library/traits/Backend.php中对应的方法复制到当前控制器,然后进行修改
*/
/**
* 查看
*/
public function index()
{
//当前是否为关联查询
$this->relationSearch = true;
//设置过滤方法
$this->request->filter(['strip_tags', 'trim']);
if ($this->request->isAjax()) {
//如果发送的来源是Selectpage则转发到Selectpage
if ($this->request->request('keyField')) {
return $this->selectpage();
}
list($where, $sort, $order, $offset, $limit) = $this->buildparams();
$list = $this->model
->with(['manystore','shop'])
->where($where)
->order($sort, $order)
->paginate($limit);
foreach ($list as $row) {
$row->getRelation('manystore')->visible(['nickname']);
$row->getRelation('shop')->visible(['name','logo']);
}
$result = array("total" => $list->total(), "rows" => $list->items());
return json($result);
}
return $this->view->fetch();
}
/**
* 添加
*
* @return string
* @throws \think\Exception
*/
public function add()
{
if (false === $this->request->isPost()) {
return $this->view->fetch();
}
$params = $this->request->post('row/a');
if (empty($params)) {
$this->error(__('Parameter %s can not be empty', ''));
}
$params = $this->preExcludeFields($params);
if ($this->dataLimit && $this->dataLimitFieldAutoFill) {
$params[$this->dataLimitField] = $this->auth->id;
}
$result = false;
Db::startTrans();
try {
//是否采用模型验证
if ($this->modelValidate) {
$name = str_replace("\\model\\", "\\validate\\", get_class($this->model));
$validate = is_bool($this->modelValidate) ? ($this->modelSceneValidate ? $name . '.add' : $name) : $this->modelValidate;
$this->model->validateFailException()->validate($validate);
}
$shop_id = $params["shop_id"];
if(!$params["shop_id"] && !$params["user_id"]) throw new \Exception("必须选填店铺或者用户!");
if($shop_id){
$manystore = Manystore::where("shop_id",$shop_id)->find();
if(!$manystore){
throw new \Exception("店铺不存在");
}
// if(!(new \app\common\model\dyqc\ManystoreShop)->checkFull($shop_id))throw new \Exception("对方的认证信息未完善,请您先去帮忙完善!");
$params["store_id"] = $manystore["id"];
$params["user_id"] = $manystore["user_id"];
}
if($params["user_id"]){
$manystore = Manystore::where("user_id",$params["user_id"])->find();
if($manystore){
$params["store_id"] = $manystore["id"];
$params["shop_id"] = $manystore["shop_id"];
}
}
$result = $this->model->allowField(true)->save($params);
User::where("id" ,$params["user_id"])->update(["business_type"=>"1"]);
Db::commit();
} catch (ValidateException|PDOException|\Exception $e) {
Db::rollback();
$this->error($e->getMessage());
}
if ($result === false) {
$this->error(__('No rows were inserted'));
}
$this->success();
}
/**
* 编辑
*
* @param $ids
* @return string
* @throws DbException
* @throws \think\Exception
*/
public function edit($ids = null)
{
$row = $this->model->get($ids);
if (!$row) {
$this->error(__('No Results were found'));
}
$adminIds = $this->getDataLimitAdminIds();
if (is_array($adminIds) && !in_array($row[$this->dataLimitField], $adminIds)) {
$this->error(__('You have no permission'));
}
if (false === $this->request->isPost()) {
$this->view->assign('row', $row);
return $this->view->fetch();
}
$params = $this->request->post('row/a');
if (empty($params)) {
$this->error(__('Parameter %s can not be empty', ''));
}
$params = $this->preExcludeFields($params);
$result = false;
Db::startTrans();
try {
//是否采用模型验证
if ($this->modelValidate) {
$name = str_replace("\\model\\", "\\validate\\", get_class($this->model));
$validate = is_bool($this->modelValidate) ? ($this->modelSceneValidate ? $name . '.edit' : $name) : $this->modelValidate;
$row->validateFailException()->validate($validate);
}
$shop_id = $params["shop_id"];
if(!$params["shop_id"] && !$params["user_id"]) throw new \Exception("必须选填店铺或者用户!");
if($shop_id){
$manystore = Manystore::where("shop_id",$shop_id)->find();
if(!$manystore){
throw new \Exception("店铺不存在");
}
// if(!(new \app\common\model\dyqc\ManystoreShop)->checkFull($shop_id))throw new \Exception("对方的认证信息未完善,请您先去帮忙完善!");
$params["store_id"] = $manystore["id"];
$params["user_id"] = $manystore["user_id"];
}
if($params["user_id"]){
$manystore = Manystore::where("user_id",$params["user_id"])->find();
if($manystore){
$params["store_id"] = $manystore["id"];
$params["shop_id"] = $manystore["shop_id"];
}
}
User::where("id" ,$row["user_id"])->update(["business_type"=>"2"]);
$result = $row->allowField(true)->save($params);
User::where("id" ,$params["user_id"])->update(["business_type"=>"1"]);
Db::commit();
} catch (ValidateException|PDOException|\Exception $e) {
Db::rollback();
$this->error($e->getMessage());
}
if (false === $result) {
$this->error(__('No rows were updated'));
}
$this->success();
}
}

View File

@ -62,7 +62,7 @@ class OrderCode extends Backend
foreach ($list as $row) {
$row->getRelation('order')->visible(['order_no',"status"]);
$row->getRelation('order')->visible(['order_no',"status","desc"]);
$row->getRelation('user')->visible(['nickname','realname','mobile','avatar']);
$row->getRelation('orderuser')->visible(['nickname','mobile','avatar']);
}

View File

@ -0,0 +1,24 @@
<?php
return [
'Shop_id' => '申请的机构id',
'Store_id' => '机构管理ID',
'Status' => '类型',
'Status 1' => '生产环境',
'Set status to 1' => '设为生产环境',
'Status 2' => '沙箱测试环境',
'Set status to 2' => '设为沙箱测试环境',
'Merchant_no' => '拉卡拉商户号',
'Online_scanning_terminal_no' => '线上扫码终端号',
'Offline_scanning_terminal_no' => '线下扫码终端号',
'Quick_terminal_no' => '快捷终端号',
'Online_banking_terminal_no' => '网银终端号',
'Offline_pos_terminal_no' => '线下POS终端号',
'Desc' => '备注',
'Createtime' => '创建时间',
'Updatetime' => '修改时间',
'Deletetime' => '删除时间',
'Manystore.nickname' => '昵称',
'Shop.name' => '店铺名称',
'Shop.logo' => '品牌LOGO'
];

View File

@ -0,0 +1,60 @@
<?php
namespace app\admin\model\manystore;
use app\admin\model\dyqc\ManystoreShop;
use think\Model;
use traits\model\SoftDelete;
class LakalaBusiness extends Model
{
use SoftDelete;
// 表名
protected $name = 'manystore_lakala_business';
// 自动写入时间戳字段
protected $autoWriteTimestamp = 'integer';
// 定义时间戳字段名
protected $createTime = 'createtime';
protected $updateTime = 'updatetime';
protected $deleteTime = 'deletetime';
// 追加属性
protected $append = [
'status_text'
];
public function getStatusList()
{
return ['1' => __('Status 1'), '2' => __('Status 2')];
}
public function getStatusTextAttr($value, $data)
{
$value = $value ? $value : (isset($data['status']) ? $data['status'] : '');
$list = $this->getStatusList();
return isset($list[$value]) ? $list[$value] : '';
}
public function manystore()
{
return $this->belongsTo('app\admin\model\Manystore', 'store_id', 'id', [], 'LEFT')->setEagerlyType(0);
}
public function shop()
{
return $this->belongsTo(ManystoreShop::class, 'shop_id', 'id', [], 'LEFT')->setEagerlyType(0);
}
}

View File

@ -0,0 +1,27 @@
<?php
namespace app\admin\validate\manystore;
use think\Validate;
class LakalaBusiness extends Validate
{
/**
* 验证规则
*/
protected $rule = [
];
/**
* 提示消息
*/
protected $message = [
];
/**
* 验证场景
*/
protected $scene = [
'add' => [],
'edit' => [],
];
}

View File

@ -0,0 +1,92 @@
<form id="add-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">{:__('Shop_id')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-shop_id" data-source="dyqc/manystore_shop/index" class="form-control selectpage" name="row[shop_id]" type="text" value="{$q_shop_id}">
<span style="color: red">
(机构和用户选填其一 ,没找到机构则点击按钮创建机构后重新下拉框选机构)
<a href="javascript:;" data-url="manystore/index/add" class="btn btn-success btn-changeuser {:$auth->check('manystore/index/add')?'':'hide'}" title="{:__('Add')}" ><i class="fa fa-plus"></i> {:__('Add')}</a>
</span>
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('User_id')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-user_id" data-source="user/user/index" data-field="mobile" data-format-item="{id} - {nickname} - {mobile}" class="form-control selectpage" name="row[user_id]" type="text" value="{$q_user_id}">
<span style="color: red">
(机构和用户选填其一 ,没找到用户则点击按钮创建用户后重新下拉框选用户)
<a data-url="user/user/changeuser" href="javascript:;" class="btn btn-success btn-changeuser {:$auth->check('user/user/changeuser')?'':'hide'}" title="根据手机号生成用户" ><i class="fa fa-plus"></i> 根据手机号生成用户</a>
</span>
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Status')}:</label>
<div class="col-xs-12 col-sm-8">
<div class="radio">
{foreach name="statusList" item="vo"}
<label for="row[status]-{$key}"><input id="row[status]-{$key}" name="row[status]" type="radio" value="{$key}" {in name="key" value="1"}checked{/in} /> {$vo}</label>
{/foreach}
</div>
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Merchant_no')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-merchant_no" data-rule="required" class="form-control" name="row[merchant_no]" type="text">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Online_scanning_terminal_no')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-online_scanning_terminal_no" data-rule="required" class="form-control" name="row[online_scanning_terminal_no]" type="text">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Offline_scanning_terminal_no')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-offline_scanning_terminal_no" class="form-control" name="row[offline_scanning_terminal_no]" type="text">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Quick_terminal_no')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-quick_terminal_no" class="form-control" name="row[quick_terminal_no]" type="text">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Online_banking_terminal_no')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-online_banking_terminal_no" class="form-control" name="row[online_banking_terminal_no]" type="text">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Offline_pos_terminal_no')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-offline_pos_terminal_no" class="form-control" name="row[offline_pos_terminal_no]" type="text">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Desc')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-desc" class="form-control" name="row[desc]" type="text">
</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-primary btn-embossed disabled">{:__('OK')}</button>
</div>
</div>
</form>

View File

@ -0,0 +1,93 @@
<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">{:__('Shop_id')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-shop_id" data-source="dyqc/manystore_shop/index" class="form-control selectpage" name="row[shop_id]" type="text" value="{$row.shop_id|htmlentities}">
<span style="color: red">
(机构和用户选填其一 ,没找到机构则点击按钮创建机构后重新下拉框选机构)
<a href="javascript:;" data-url="manystore/index/add" class="btn btn-success btn-changeuser {:$auth->check('manystore/index/add')?'':'hide'}" title="{:__('Add')}" ><i class="fa fa-plus"></i> {:__('Add')}</a>
</span>
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('User_id')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-user_id" data-source="user/user/index" data-field="mobile" data-format-item="{id} - {nickname} - {mobile}" class="form-control selectpage" name="row[user_id]" type="text" value="{$row.user_id|htmlentities}">
<span style="color: red">
(机构和用户选填其一 ,没找到用户则点击按钮创建用户后重新下拉框选用户)
<a data-url="user/user/changeuser" href="javascript:;" class="btn btn-success btn-changeuser {:$auth->check('user/user/changeuser')?'':'hide'}" title="根据手机号生成用户" ><i class="fa fa-plus"></i> 根据手机号生成用户</a>
</span>
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Status')}:</label>
<div class="col-xs-12 col-sm-8">
<div class="radio">
{foreach name="statusList" item="vo"}
<label for="row[status]-{$key}"><input id="row[status]-{$key}" name="row[status]" type="radio" value="{$key}" {in name="key" value="$row.status"}checked{/in} /> {$vo}</label>
{/foreach}
</div>
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Merchant_no')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-merchant_no" data-rule="required" class="form-control" name="row[merchant_no]" type="text" value="{$row.merchant_no|htmlentities}">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Online_scanning_terminal_no')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-online_scanning_terminal_no" data-rule="required" class="form-control" name="row[online_scanning_terminal_no]" type="text" value="{$row.online_scanning_terminal_no|htmlentities}">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Offline_scanning_terminal_no')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-offline_scanning_terminal_no" class="form-control" name="row[offline_scanning_terminal_no]" type="text" value="{$row.offline_scanning_terminal_no|htmlentities}">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Quick_terminal_no')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-quick_terminal_no" class="form-control" name="row[quick_terminal_no]" type="text" value="{$row.quick_terminal_no|htmlentities}">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Online_banking_terminal_no')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-online_banking_terminal_no" class="form-control" name="row[online_banking_terminal_no]" type="text" value="{$row.online_banking_terminal_no|htmlentities}">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Offline_pos_terminal_no')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-offline_pos_terminal_no" class="form-control" name="row[offline_pos_terminal_no]" type="text" value="{$row.offline_pos_terminal_no|htmlentities}">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Desc')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-desc" class="form-control" name="row[desc]" type="text" value="{$row.desc|htmlentities}">
</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-primary btn-embossed disabled">{:__('OK')}</button>
</div>
</div>
</form>

View File

@ -0,0 +1,46 @@
<div class="panel panel-default panel-intro">
<div class="panel-heading">
{:build_heading(null,FALSE)}
<ul class="nav nav-tabs" data-field="status">
<li class="{:$Think.get.status === null ? 'active' : ''}"><a href="#t-all" data-value="" data-toggle="tab">{:__('All')}</a></li>
{foreach name="statusList" item="vo"}
<li class="{:$Think.get.status === (string)$key ? 'active' : ''}"><a href="#t-{$key}" data-value="{$key}" data-toggle="tab">{$vo}</a></li>
{/foreach}
</ul>
</div>
<div class="panel-body">
<div id="myTabContent" class="tab-content">
<div class="tab-pane fade active in" id="one">
<div class="widget-body no-padding">
<div id="toolbar" class="toolbar">
<a href="javascript:;" class="btn btn-primary btn-refresh" title="{:__('Refresh')}" ><i class="fa fa-refresh"></i> </a>
<a href="javascript:;" class="btn btn-success btn-add {:$auth->check('manystore/lakala_business/add')?'':'hide'}" title="{:__('Add')}" ><i class="fa fa-plus"></i> {:__('Add')}</a>
<a href="javascript:;" class="btn btn-success btn-edit btn-disabled disabled {:$auth->check('manystore/lakala_business/edit')?'':'hide'}" title="{:__('Edit')}" ><i class="fa fa-pencil"></i> {:__('Edit')}</a>
<a href="javascript:;" class="btn btn-danger btn-del btn-disabled disabled {:$auth->check('manystore/lakala_business/del')?'':'hide'}" title="{:__('Delete')}" ><i class="fa fa-trash"></i> {:__('Delete')}</a>
<div class="dropdown btn-group {:$auth->check('manystore/lakala_business/multi')?'':'hide'}">
<a class="btn btn-primary btn-more dropdown-toggle btn-disabled disabled" data-toggle="dropdown"><i class="fa fa-cog"></i> {:__('More')}</a>
<ul class="dropdown-menu text-left" role="menu">
{foreach name="statusList" item="vo"}
<li><a class="btn btn-link btn-multi btn-disabled disabled" href="javascript:" data-params="status={$key}">{:__('Set status to ' . $key)}</a></li>
{/foreach}
</ul>
</div>
<a class="btn btn-success btn-recyclebin btn-dialog {:$auth->check('manystore/lakala_business/recyclebin')?'':'hide'}" href="manystore/lakala_business/recyclebin" title="{:__('Recycle bin')}"><i class="fa fa-recycle"></i> {:__('Recycle bin')}</a>
</div>
<table id="table" class="table table-striped table-bordered table-hover table-nowrap"
data-operate-edit="{:$auth->check('manystore/lakala_business/edit')}"
data-operate-del="{:$auth->check('manystore/lakala_business/del')}"
width="100%">
</table>
</div>
</div>
</div>
</div>
</div>

View File

@ -0,0 +1,25 @@
<div class="panel panel-default panel-intro">
{:build_heading()}
<div class="panel-body">
<div id="myTabContent" class="tab-content">
<div class="tab-pane fade active in" id="one">
<div class="widget-body no-padding">
<div id="toolbar" class="toolbar">
{:build_toolbar('refresh')}
<a class="btn btn-info btn-multi btn-disabled disabled {:$auth->check('manystore/lakala_business/restore')?'':'hide'}" href="javascript:;" data-url="manystore/lakala_business/restore" data-action="restore"><i class="fa fa-rotate-left"></i> {:__('Restore')}</a>
<a class="btn btn-danger btn-multi btn-disabled disabled {:$auth->check('manystore/lakala_business/destroy')?'':'hide'}" href="javascript:;" data-url="manystore/lakala_business/destroy" data-action="destroy"><i class="fa fa-times"></i> {:__('Destroy')}</a>
<a class="btn btn-success btn-restoreall {:$auth->check('manystore/lakala_business/restore')?'':'hide'}" href="javascript:;" data-url="manystore/lakala_business/restore" title="{:__('Restore all')}"><i class="fa fa-rotate-left"></i> {:__('Restore all')}</a>
<a class="btn btn-danger btn-destroyall {:$auth->check('manystore/lakala_business/destroy')?'':'hide'}" href="javascript:;" data-url="manystore/lakala_business/destroy" title="{:__('Destroy all')}"><i class="fa fa-times"></i> {:__('Destroy all')}</a>
</div>
<table id="table" class="table table-striped table-bordered table-hover"
data-operate-restore="{:$auth->check('manystore/lakala_business/restore')}"
data-operate-destroy="{:$auth->check('manystore/lakala_business/destroy')}"
width="100%">
</table>
</div>
</div>
</div>
</div>
</div>

View File

@ -40,7 +40,7 @@ class Pay extends Base
* @ApiSummary(活动第三方支付(微信等支付))
* @ApiMethod(POST)
* @ApiParams(name = "order_no", type = "string",required=true,description = "订单id或订单号")
* @ApiParams(name = "type", type = "string",required=true,description = "服务商:alipay=支付宝,wechat=微信")
* @ApiParams(name = "type", type = "string",required=true,description = "服务商:alipay=支付宝,wechat=微信,lakala=拉卡拉支付")
* @ApiParams(name = "platform", type = "string",required=true,description = "平台:web=PC网页支付,wap=H5手机网页支付,app=APP支付,scan=扫码支付,mp=微信公众号支付,miniapp=微信小程序支付")
* @ApiParams(name = "openid", type = "string",required=false,description = "用户openid(非必填)")
* @ApiReturn({
@ -56,6 +56,12 @@ class Pay extends Base
$method = $this->request->post('platform/s');
$openid = $this->request->post('openid/s', "");
$platform = $method;
$lakala = false;
if($type == "lakala"){
$lakala = true;
}
try {
//订单支付前校验
$this->model->checkPay($order_no,$type);
@ -86,7 +92,7 @@ class Pay extends Base
// 没有 openid 默认拿下单人的 openid
$oauth = Third::where([
'user_id' => $order->user_id,
'platform' => $type,
'platform' => $type == "lakala" ? "wechat" : $type,
'apptype' => $platform
])->find();

View File

@ -0,0 +1,75 @@
<?php
namespace app\common\model\manystore;
use app\admin\model\dyqc\ManystoreShop;
use app\common\model\BaseModel;
use think\Model;
use traits\model\SoftDelete;
class LakalaBusiness extends BaseModel
{
use SoftDelete;
// 表名
protected $name = 'manystore_lakala_business';
// 自动写入时间戳字段
protected $autoWriteTimestamp = 'integer';
// 定义时间戳字段名
protected $createTime = 'createtime';
protected $updateTime = 'updatetime';
protected $deleteTime = 'deletetime';
// 追加属性
protected $append = [
'status_text'
];
public function getStatusList()
{
return ['1' => __('Status 1'), '2' => __('Status 2')];
}
public function getStatusTextAttr($value, $data)
{
$value = $value ? $value : (isset($data['status']) ? $data['status'] : '');
$list = $this->getStatusList();
return isset($list[$value]) ? $list[$value] : '';
}
public function manystore()
{
return $this->belongsTo('app\admin\model\Manystore', 'store_id', 'id', [], 'LEFT')->setEagerlyType(0);
}
public function shop()
{
return $this->belongsTo(ManystoreShop::class, 'shop_id', 'id', [], 'LEFT')->setEagerlyType(0);
}
public static function checkBind($user_id,$check=false){
//判断是否对接了lakala进件
if(config("site.activity_price_lakala_switch") || $check){
if(config("site.activity_pay_process") == "lakala" || $check){
$lakalaBusiness = self::where("user_id",$user_id)->find();
if(!$lakalaBusiness){
throw new \Exception("当前商户未完成拉卡拉进件以及平台绑定!");
}
}
}
}
}

View File

@ -3,6 +3,7 @@
namespace app\common\model\school\activity;
use app\common\model\manystore\LakalaBusiness;
use app\common\library\Virtual;
use app\common\model\BaseModel;
use app\common\model\school\activity\order\Order;
@ -649,6 +650,9 @@ class Activity extends BaseModel
}
//判断是否对接了lakala进件
LakalaBusiness::checkBind($params["user_id"]);
}
if($params["price"]<0)$params["price"]=0;

View File

@ -6,6 +6,7 @@ use addons\epay\library\Service;
use app\admin\model\Admin;
use app\admin\model\Manystore;
use app\common\model\BaseModel;
use app\common\model\manystore\LakalaBusiness;
use app\common\model\school\activity\Activity;
use app\common\model\school\activity\Cate;
use app\common\model\school\activity\Refund;
@ -1241,6 +1242,12 @@ class Order extends BaseModel
case "offline": //线下支付
//..
break;
case "lakala": //拉卡拉支付
$activity = Activity::where("id",$order['activity_id'])->find();
if(!$activity) throw new \Exception("此订单未关联活动");
//判断是否对接了lakala进件
LakalaBusiness::checkBind($activity["user_id"],true);
break;
case "yue": //余额支付
//支付密码判断
// $res = User::checkPayPassword($order['user_id'],$password,true);

View File

@ -22,7 +22,7 @@ return [
/**
* 可上传的文件类型
*/
'mimetype' => 'jpg,svg,png,bmp,jpeg,gif,webp,zip,rar,wav,mp4,mp3,webm,p12,pem,doc,docx,xls,xlsx,pdf,txt,md,xml',
'mimetype' => 'jpg,svg,png,bmp,jpeg,gif,webp,zip,rar,wav,mp4,mp3,webm,p12,pem,doc,docx,xls,xlsx,pdf,txt,md,xml,cer',
/**
* 是否支持批量上传
*/

View File

@ -62,7 +62,7 @@ class OrderCode extends ManystoreBase
foreach ($list as $row) {
$row->getRelation('schoolactivityorder')->visible(['order_no','pay_no',"status"]);
$row->getRelation('schoolactivityorder')->visible(['order_no','pay_no',"status","desc"]);
$row->getRelation('user')->visible(['nickname','mobile','avatar']);
$row->getRelation('schoolactivity')->visible(['title','images']);
$row->getRelation('orderuser')->visible(['nickname','mobile','avatar']);

View File

@ -0,0 +1,36 @@
<?php
namespace bw\lakala;
/**
* 拉卡拉服务
*/
class LakalaService
{
//编写单例模式
private static $instance;
private $config;
private function __construct()
{
$this->init();
}
private function __clone()
{
return;
}
public static function getInstance()
{
if (!(self::$instance instanceof self)) {
self::$instance = new self();
}
return self::$instance;
}
public function init()
{
$this->config = [
'merId' => '100000000000000',
'merKey' => '12345678901234567890123456789012',
];
}
}

View File

@ -51,6 +51,9 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
{field: 'username', title: __('Username')},
{field: 'nickname', title: __('Nickname')},
{field: 'email', title: __('Email')},
{field: 'user.business_type', title: __('商户进件完善'), searchList: {"1":__('已完善'),"2":__('未完善')}, formatter: Table.api.formatter.status},
{field: 'status', title: __("Status"), formatter: Table.api.formatter.status},
{field: 'shop.status', title: __('Auth_status'), searchList: {"0":__('Auth_status 0'),"1":__('Auth_status 1'),"2":__('Auth_status 2')}, formatter: Table.api.formatter.status},
{field: 'user_id', title: __('User_id')},
@ -144,6 +147,25 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
// }
// return false;
}},
{
name: 'lakala_business',
text: __('拉卡拉进件信息设置'),
title: __('拉卡拉进件信息设置'),
classname: 'btn btn-dialog',
icon: 'fa fa-cart-arrow-down',
dropdown : '更多',
url: lakala_business_url,
callback: function (data) {
},
// visible: function (row) {
// return row.status == '2'||row.status == '3';
// }
},
// {name: 'freeapi',
// text: '免登录进入机构API版后台',
// icon: 'fa fa-sign-in',
@ -185,37 +207,37 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
// // return row.status == '2'||row.status == '3';
// // }
// },
// {
// name: 'activity',
// text: __('机构线上活动'),
// title: __('机构线上活动'),
// classname: 'btn btn-dialog',
// icon: 'fa fa-leanpub',
// dropdown : '更多',
// url: activity_url,
// callback: function (data) {
//
// },
// // visible: function (row) {
// // return row.paytime;
// // }
// },
//
// {
// name: 'teacher',
// text: __('主讲老师信息'),
// title: __('主讲老师信息'),
// classname: 'btn btn-dialog',
// icon: 'fa fa-user',
// dropdown : '更多',
// url: teacher_url,
// callback: function (data) {
//
// },
// // visible: function (row) {
// // return row.status == '2'||row.status == '3';
// // }
// },
{
name: 'activity',
text: __('机构活动'),
title: __('机构活动'),
classname: 'btn btn-dialog',
icon: 'fa fa-leanpub',
dropdown : '更多',
url: activity_url,
callback: function (data) {
},
// visible: function (row) {
// return row.paytime;
// }
},
{
name: 'user',
text: __('申请用户信息'),
title: __('申请用户信息'),
classname: 'btn btn-dialog',
icon: 'fa fa-user',
dropdown : '更多',
url: user_url,
callback: function (data) {
},
// visible: function (row) {
// return row.status == '2'||row.status == '3';
// }
},
// {
// name: 'verification',
// text: __('核销员信息'),
@ -462,8 +484,8 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
var virtual_user_url = function (row,dom) {
return 'school/classes/virtual_user/index?shop_id='+row.shop_id;
}
var teacher_url = function (row,dom) {
return 'school/classes/teacher/index?shop_id='+row.shop_id;
var user_url = function (row,dom) {
return 'user/user/index?id='+row.user_id;
}
@ -494,8 +516,12 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
return 'school/classes/activity/order/order/index?shop_id='+row.shop_id;
}
var lakala_business_url = function (row,dom) {
return 'manystore/lakala_business/index?user_id='+row.user_id;
}
var activity_url = function (row,dom) {
return 'school/classes/activity/activity/index?shop_id='+row.shop_id;
return 'school/activity/activity/index?user_id='+row.user_id;
}

View File

@ -0,0 +1,169 @@
define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
var Controller = {
index: function () {
// 初始化表格参数配置
Table.api.init({
extend: {
index_url: 'manystore/lakala_business/index' + location.search,
add_url: 'manystore/lakala_business/add'+ location.search,
edit_url: 'manystore/lakala_business/edit',
del_url: 'manystore/lakala_business/del',
multi_url: 'manystore/lakala_business/multi',
import_url: 'manystore/lakala_business/import',
table: 'manystore_lakala_business',
}
});
var table = $("#table");
// 初始化表格
table.bootstrapTable({
url: $.fn.bootstrapTable.defaults.extend.index_url,
pk: 'id',
sortName: 'id',
fixedColumns: true,
fixedRightNumber: 1,
columns: [
[
{checkbox: true},
{field: 'id', title: __('Id')},
// {field: 'manystore.nickname', title: __('Manystore.nickname'), operate: 'LIKE'},
// {field: 'shop.name', title: __('Shop.name'), operate: 'LIKE'},
// {field: 'shop.logo', title: __('Logo'), operate: false, events: Table.api.events.image, formatter: Table.api.formatter.image},
{field: 'shop_id',visible:false, title: __('Shop_id')},
{field: 'store_id',visible:false, title: __('Store_id')},
{field: 'user_id', title: __('申请用户id')},
{field: 'status', title: __('Status'), searchList: {"1":__('Status 1'),"2":__('Status 2')}, formatter: Table.api.formatter.status},
{field: 'merchant_no', title: __('Merchant_no'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
{field: 'online_scanning_terminal_no', title: __('Online_scanning_terminal_no'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
{field: 'offline_scanning_terminal_no', title: __('Offline_scanning_terminal_no'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
{field: 'quick_terminal_no', title: __('Quick_terminal_no'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
{field: 'online_banking_terminal_no', title: __('Online_banking_terminal_no'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
{field: 'offline_pos_terminal_no', title: __('Offline_pos_terminal_no'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
{field: 'desc', title: __('Desc'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
{field: 'createtime', title: __('Createtime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
{field: 'updatetime', title: __('Updatetime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
{field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
]
]
});
$(document).on('click', '.btn-changeuser', function (event) {
var url = $(this).attr('data-url');
if(!url) return false;
var title = $(this).attr('title');
var width = $(this).attr('data-width');
var height = $(this).attr('data-height');
// var ids = $(this).attr('data-id');
var area = ['98%','98%'];
var options = {
shadeClose: false,
shade: [0.3, '#393D49'],
area: area,
callback:function(ret){//回调方法需要在本页面Controller中增加方法监听且调用Fast.api.close(ret)传递结果;
Fast.api.close(ret);
}
};
Fast.api.open(url,title,options);
});
// 为表格绑定事件
Table.api.bindevent(table);
},
recyclebin: function () {
// 初始化表格参数配置
Table.api.init({
extend: {
'dragsort_url': ''
}
});
var table = $("#table");
// 初始化表格
table.bootstrapTable({
url: 'manystore/lakala_business/recyclebin' + location.search,
pk: 'id',
sortName: 'id',
columns: [
[
{checkbox: true},
{field: 'id', title: __('Id')},
{
field: 'deletetime',
title: __('Deletetime'),
operate: 'RANGE',
addclass: 'datetimerange',
formatter: Table.api.formatter.datetime
},
{
field: 'operate',
width: '140px',
title: __('Operate'),
table: table,
events: Table.api.events.operate,
buttons: [
{
name: 'Restore',
text: __('Restore'),
classname: 'btn btn-xs btn-info btn-ajax btn-restoreit',
icon: 'fa fa-rotate-left',
url: 'manystore/lakala_business/restore',
refresh: true
},
{
name: 'Destroy',
text: __('Destroy'),
classname: 'btn btn-xs btn-danger btn-ajax btn-destroyit',
icon: 'fa fa-times',
url: 'manystore/lakala_business/destroy',
refresh: true
}
],
formatter: Table.api.formatter.operate
}
]
]
});
// 为表格绑定事件
Table.api.bindevent(table);
},
add: function () {
Controller.api.bindevent();
},
edit: function () {
Controller.api.bindevent();
},
api: {
bindevent: function () {
$(document).on('click', '.btn-changeuser', function (event) {
var url = $(this).attr('data-url');
if(!url) return false;
var title = $(this).attr('title');
var width = $(this).attr('data-width');
var height = $(this).attr('data-height');
// var ids = $(this).attr('data-id');
var area = ['98%','98%'];
var options = {
shadeClose: false,
shade: [0.3, '#393D49'],
area: area,
callback:function(ret){//回调方法需要在本页面Controller中增加方法监听且调用Fast.api.close(ret)传递结果;
Fast.api.close(ret);
}
};
Fast.api.open(url,title,options);
});
Form.api.bindevent($("form[role=form]"));
}
}
};
return Controller;
});

View File

@ -41,6 +41,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
{field: 'idnum', title: __('身份证号'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
{field: 'orderuser.mobile', title: __('下单人手机号'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
{field: 'order.desc', title: __('备注'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
{field: 'code', title: __('Code'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},

View File

@ -38,6 +38,7 @@ define(['jquery', 'bootstrap', 'backend', 'csmtable', 'form'], function ($, unde
{field: 'settle_info.settled_amount', title: __('可提现金额'), operate: false},
{field: 'settle_info.expected_incoming_amount', title: __('预期收益'), operate: false},
{field: 'settle_info.accumulated_incoming_amount', title: __('累计收入'), operate: false},
{field: 'business_type', title: __('商户进件完善'), searchList: {"1":__('已完善'),"2":__('未完善')}, formatter: Table.api.formatter.status},

View File

@ -43,6 +43,8 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
{field: 'orderuser.mobile', title: __('下单人手机号'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
{field: 'schoolactivityorder.desc', title: __('备注'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
{field: 'code', title: __('Code'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},