init commit
This commit is contained in:
371
application/admin/controller/wdsxh/activity/Activity.php
Normal file
371
application/admin/controller/wdsxh/activity/Activity.php
Normal file
@@ -0,0 +1,371 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | 麦沃德科技赋能开发者,助力商协会发展
|
||||
// +----------------------------------------------------------------------
|
||||
// | Copyright (c) 2017~2024 www.wdsxh.cn All rights reserved.
|
||||
// +----------------------------------------------------------------------
|
||||
// | 沃德商协会系统并不是自由软件,不加密,并不代表开源,未经许可不可自由转售和商用
|
||||
// +----------------------------------------------------------------------
|
||||
// | Author: MY WORLD Team <bd@maiwd.cn> www.maiwd.cn
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\admin\controller\wdsxh\activity;
|
||||
|
||||
use addons\wdsxh\library\Encryptor;
|
||||
use app\admin\model\wdsxh\Config;
|
||||
use app\common\controller\Backend;
|
||||
use EasyWeChat\Factory;
|
||||
use think\Db;
|
||||
use think\db\exception\DataNotFoundException;
|
||||
use think\db\exception\ModelNotFoundException;
|
||||
use think\exception\DbException;
|
||||
use think\exception\PDOException;
|
||||
use think\exception\ValidateException;
|
||||
use Exception;
|
||||
|
||||
/**
|
||||
* 活动列管理
|
||||
*
|
||||
* @icon fa fa-circle-o
|
||||
*/
|
||||
class Activity extends Backend
|
||||
{
|
||||
|
||||
/**
|
||||
* Activity模型对象
|
||||
* @var \app\admin\model\wdsxh\activity\Activity
|
||||
*/
|
||||
protected $model = null;
|
||||
|
||||
protected $modelValidate = true;
|
||||
protected $modelSceneValidate = true;
|
||||
|
||||
public function _initialize()
|
||||
{
|
||||
parent::_initialize();
|
||||
$this->model = new \app\admin\model\wdsxh\activity\Activity;
|
||||
$this->view->assign("organizingMethodList", $this->model->getOrganizingMethodList());
|
||||
$this->view->assign("stateList", $this->model->getStateList());
|
||||
$this->view->assign("isVerifyingList", $this->model->getIsVerifyingList());
|
||||
$this->view->assign("statusList", $this->model->getStatusList());
|
||||
$this->view->assign("activityAuthList", $this->model->getActivityAuthList());
|
||||
$this->view->assign("nonMemberRegistrationStatusList", $this->model->getNonMemberRegistrationStatusList());
|
||||
$this->view->assign("verificationMethodList", $this->model->getVerificationMethodList());
|
||||
$this->view->assign("pointsStatusList", $this->model->getPointsStatusList());
|
||||
$configObj = (new Config())->get(1);
|
||||
$this->assignconfig('wananchi_appid',$configObj['wananchi_appid']);
|
||||
$this->assignconfig('applet_appid',$configObj['applet_appid']);
|
||||
$this->view->assign("applyFieldStateList", $this->model->getApplyFieldStateList());
|
||||
$this->view->assign("certificateEnabledList", $this->model->getCertificateEnabledList());
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 默认生成的控制器所继承的父类中有index/add/edit/del/multi五个基础方法、destroy/restore/recyclebin三个回收站方法
|
||||
* 因此在当前控制器中可不用编写增删改查的代码,除非需要自己控制这部分逻辑
|
||||
* 需要将application/admin/library/traits/Backend.php中对应的方法复制到当前控制器,然后进行修改
|
||||
*/
|
||||
|
||||
/**
|
||||
* 添加
|
||||
*
|
||||
* @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;
|
||||
}
|
||||
if ($params['is_verifying'] == 2) {
|
||||
$params['verifying_wechat_ids'] = '';
|
||||
}
|
||||
$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);
|
||||
}
|
||||
$result = $this->model->allowField(true)->save($params);
|
||||
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()) {
|
||||
$show_applet_activity_qrcode = 2;
|
||||
$applet_activity_qrcode_path = '';
|
||||
$save_path = '/uploads/wdsxh/applet_activity_qrcode/'.$row['id'].'/'.$row['createtime'].'.png';
|
||||
if (is_file(ROOT_PATH."public".$save_path)) {
|
||||
$applet_activity_qrcode_path = $this->request->domain().$save_path;
|
||||
$show_applet_activity_qrcode = 1;
|
||||
} else {
|
||||
$configObj = (new \app\admin\model\wdsxh\Config())->where('id',1)->find();
|
||||
if (!empty($configObj['applet_appid']) && !empty($configObj['applet_secret'])) {
|
||||
$path = 'pagesActivity/index/details';
|
||||
$config = [
|
||||
'app_id' => $configObj['applet_appid'],
|
||||
'secret' => $configObj['applet_secret'],
|
||||
'response_type' => 'array',
|
||||
'log' => [
|
||||
'level' => 'debug',
|
||||
],
|
||||
];
|
||||
|
||||
$app = Factory::miniProgram($config);
|
||||
|
||||
$response = $app->app_code->getUnlimit($ids, [
|
||||
'page' => $path,
|
||||
'check_path' => false,
|
||||
]);
|
||||
|
||||
if ($response instanceof \EasyWeChat\Kernel\Http\StreamResponse) {
|
||||
$response->saveAs('uploads/wdsxh/applet_activity_qrcode/'.$row['id'], $row['createtime'].'.png');
|
||||
$applet_activity_qrcode_path = $this->request->domain().$save_path;
|
||||
$show_applet_activity_qrcode = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$this->view->assign('show_applet_activity_qrcode', $show_applet_activity_qrcode);
|
||||
$this->view->assign('applet_activity_qrcode_path', $applet_activity_qrcode_path);
|
||||
$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);
|
||||
if ($params['is_verifying'] == 2) {
|
||||
$params['verifying_wechat_ids'] = '';
|
||||
$params['verification_method'] = 0;
|
||||
}
|
||||
if ($params['verification_method'] == 1) {
|
||||
$params['verifying_wechat_ids'] = '';
|
||||
}
|
||||
if ($params['points_status'] == 2) {
|
||||
$params['points'] = 0;
|
||||
}
|
||||
$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);
|
||||
}
|
||||
$result = $row->allowField(true)->save($params);
|
||||
Db::commit();
|
||||
} catch (ValidateException|PDOException|Exception $e) {
|
||||
Db::rollback();
|
||||
$this->error($e->getMessage());
|
||||
}
|
||||
if (false === $result) {
|
||||
$this->error(__('No rows were updated'));
|
||||
}
|
||||
$this->success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除
|
||||
*
|
||||
* @param $ids
|
||||
* @return void
|
||||
* @throws DbException
|
||||
* @throws DataNotFoundException
|
||||
* @throws ModelNotFoundException
|
||||
*/
|
||||
public function del($ids = null)
|
||||
{
|
||||
if (false === $this->request->isPost()) {
|
||||
$this->error(__("Invalid parameters"));
|
||||
}
|
||||
$ids = $ids ?: $this->request->post("ids");
|
||||
if (empty($ids)) {
|
||||
$this->error(__('Parameter %s can not be empty', 'ids'));
|
||||
}
|
||||
$pk = $this->model->getPk();
|
||||
$adminIds = $this->getDataLimitAdminIds();
|
||||
if (is_array($adminIds)) {
|
||||
$this->model->where($this->dataLimitField, 'in', $adminIds);
|
||||
}
|
||||
$list = $this->model->where($pk, 'in', $ids)->select();
|
||||
|
||||
$activityApplyModel = new \app\admin\model\wdsxh\activity\ActivityApply();
|
||||
foreach ($list as $item) {
|
||||
if ($item['state'] == '2') {
|
||||
$this->error('活动:'.$item['name'].',进行中,无法删除');
|
||||
}
|
||||
$apply_count = $activityApplyModel->where('activity_id',$item['id'])->where('state','2')->count();
|
||||
if ($item['state'] == '1' && $apply_count) {
|
||||
$this->error('活动:'.$item['name'].',报名中,有会员报名成功,无法删除');
|
||||
}
|
||||
}
|
||||
|
||||
$count = 0;
|
||||
Db::startTrans();
|
||||
try {
|
||||
foreach ($list as $item) {
|
||||
$count += $item->delete();
|
||||
}
|
||||
Db::commit();
|
||||
} catch (PDOException|Exception $e) {
|
||||
Db::rollback();
|
||||
$this->error($e->getMessage());
|
||||
}
|
||||
if ($count) {
|
||||
$this->success();
|
||||
}
|
||||
$this->error(__('No rows were deleted'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Desc 公众号签到二维码
|
||||
* Create on 2025/3/6 17:49
|
||||
* Create by wangyafang
|
||||
*/
|
||||
public function verification_qr_code($ids)
|
||||
{
|
||||
if (false === $this->request->isPost()) {
|
||||
$qrcode_class = 1;
|
||||
$row = $this->model->get($ids);
|
||||
$this->view->assign('row', $row);
|
||||
if (!class_exists('\Endroid\QrCode\QrCode')) {
|
||||
$qrcode_class = 2;
|
||||
} else {
|
||||
$path = $this->create_qr_code($ids,$row);
|
||||
|
||||
$this->view->assign('path', $path);
|
||||
}
|
||||
$this->view->assign('qrcode_class', $qrcode_class);
|
||||
return $this->view->fetch();
|
||||
}
|
||||
}
|
||||
|
||||
private function create_qr_code($id,$activityObj)
|
||||
{
|
||||
$activity_wananchi_sign_path_path = '';
|
||||
$domain = $this->request->domain();
|
||||
$save_path = DIRECTORY_SEPARATOR.'uploads'.DIRECTORY_SEPARATOR.'wdsxh'.DIRECTORY_SEPARATOR.'activity_wananchi_sign_path'.DIRECTORY_SEPARATOR.$id.DIRECTORY_SEPARATOR.$activityObj['createtime'].'activity.png';
|
||||
if (is_file(ROOT_PATH."public".$save_path)) {
|
||||
$activity_wananchi_sign_path_path = $this->request->domain().$save_path;
|
||||
} else {
|
||||
$token_key = config('token.key');
|
||||
$encryptor = new Encryptor(substr($token_key,0,16),substr($token_key,16));
|
||||
$validate_value = $encryptor->encrypt($id);
|
||||
$params['text'] = $this->request->get('text', $domain.'/web/#/pagesActivity/order/details?scene='.$validate_value, 'trim');
|
||||
$qrCode = \addons\qrcode\library\Service::qrcode($params);
|
||||
$qrcodePath = ROOT_PATH . 'public'.DIRECTORY_SEPARATOR.'uploads'.DIRECTORY_SEPARATOR.'wdsxh'.DIRECTORY_SEPARATOR.'activity_wananchi_sign_path'.DIRECTORY_SEPARATOR.$id.DIRECTORY_SEPARATOR;
|
||||
if (!is_dir($qrcodePath)) {
|
||||
wdsxh_mkdirs($qrcodePath);
|
||||
}
|
||||
if (is_really_writable($qrcodePath)) {
|
||||
$filePath = $qrcodePath . $activityObj['createtime'].'activity.png';
|
||||
$qrCode->writeFile($filePath);
|
||||
$save_path = DIRECTORY_SEPARATOR.'uploads'.DIRECTORY_SEPARATOR.'wdsxh'.DIRECTORY_SEPARATOR.'activity_wananchi_sign_path'.DIRECTORY_SEPARATOR.$id.DIRECTORY_SEPARATOR.$activityObj['createtime'].'activity.png';
|
||||
$activity_wananchi_sign_path_path = $this->request->domain().$save_path;
|
||||
}
|
||||
}
|
||||
return $activity_wananchi_sign_path_path;
|
||||
}
|
||||
|
||||
/**
|
||||
* Desc 小程序签到二维码
|
||||
* Create on 2025/3/6 17:49
|
||||
* Create by wangyafang
|
||||
*/
|
||||
public function verification_applet_code($ids)
|
||||
{
|
||||
if (false === $this->request->isPost()) {
|
||||
$row = $this->model->get($ids);
|
||||
$this->view->assign('row', $row);
|
||||
$path = $this->create_applet_code($ids,$row);
|
||||
|
||||
$this->view->assign('path', $path);
|
||||
return $this->view->fetch();
|
||||
}
|
||||
}
|
||||
|
||||
private function create_applet_code($id,$activityObj)
|
||||
{
|
||||
$activity_qrcode_path = '';
|
||||
$row = $activityObj;
|
||||
$save_path = DIRECTORY_SEPARATOR.'uploads'.DIRECTORY_SEPARATOR.'wdsxh'.DIRECTORY_SEPARATOR.'activity_applet_sign_path'.DIRECTORY_SEPARATOR.$id.DIRECTORY_SEPARATOR.$activityObj['createtime'].'activity.png';
|
||||
if (is_file(ROOT_PATH."public".$save_path)) {
|
||||
$activity_qrcode_path = $this->request->domain().$save_path;
|
||||
} else {
|
||||
$ids = $row['id'];
|
||||
$configObj = (new \app\admin\model\wdsxh\Config())->where('id',1)->find();
|
||||
if (!empty($configObj['applet_appid']) && !empty($configObj['applet_secret'])) {
|
||||
$path = 'pagesActivity/order/details';
|
||||
$config = [
|
||||
'app_id' => $configObj['applet_appid'],
|
||||
'secret' => $configObj['applet_secret'],
|
||||
'response_type' => 'array',
|
||||
'log' => [
|
||||
'level' => 'debug',
|
||||
],
|
||||
];
|
||||
|
||||
$app = Factory::miniProgram($config);
|
||||
$token_key = config('token.key');
|
||||
$encryptor = new Encryptor(substr($token_key,0,16),substr($token_key,16));
|
||||
$scene = $validate_value = $encryptor->encrypt($id);
|
||||
|
||||
|
||||
$response = $app->app_code->getUnlimit($scene, [
|
||||
'page' => $path,
|
||||
'check_path' => false,
|
||||
]);
|
||||
|
||||
if ($response instanceof \EasyWeChat\Kernel\Http\StreamResponse) {
|
||||
$response->saveAs('uploads/wdsxh/activity_applet_sign_path/'.$row['id'], $row['createtime'].'activity.png');
|
||||
$activity_qrcode_path = $this->request->domain().$save_path;
|
||||
}
|
||||
}
|
||||
}
|
||||
return $activity_qrcode_path;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
299
application/admin/controller/wdsxh/activity/ActivityApply.php
Normal file
299
application/admin/controller/wdsxh/activity/ActivityApply.php
Normal file
@@ -0,0 +1,299 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | 麦沃德科技赋能开发者,助力商协会发展
|
||||
// +----------------------------------------------------------------------
|
||||
// | Copyright (c) 2017~2024 www.wdsxh.cn All rights reserved.
|
||||
// +----------------------------------------------------------------------
|
||||
// | 沃德商协会系统并不是自由软件,不加密,并不代表开源,未经许可不可自由转售和商用
|
||||
// +----------------------------------------------------------------------
|
||||
// | Author: MY WORLD Team <bd@maiwd.cn> www.maiwd.cn
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\admin\controller\wdsxh\activity;
|
||||
|
||||
use app\admin\model\wdsxh\activity\Order;
|
||||
use app\api\model\wdsxh\activity\ActivityApplyRecord;
|
||||
use app\common\controller\Backend;
|
||||
use think\Db;
|
||||
use think\exception\DbException;
|
||||
use think\exception\PDOException;
|
||||
use think\exception\ValidateException;
|
||||
|
||||
/**
|
||||
* 活动报名
|
||||
*
|
||||
* @icon fa fa-circle-o
|
||||
*/
|
||||
class ActivityApply extends Backend
|
||||
{
|
||||
|
||||
/**
|
||||
* ActivityApply模型对象
|
||||
* @var \app\admin\model\wdsxh\activity\ActivityApply
|
||||
*/
|
||||
protected $model = null;
|
||||
|
||||
public function _initialize()
|
||||
{
|
||||
parent::_initialize();
|
||||
$this->model = new \app\admin\model\wdsxh\activity\ActivityApply;
|
||||
$this->view->assign("stateList", $this->model->getStateList());
|
||||
$this->view->assign("isSignInList", $this->model->getIsSignInList());
|
||||
$param = $this->request->get();
|
||||
$activity_id = isset($param['activity_id']) ? $param['activity_id'] : '';
|
||||
$this->assign('activity_id',$activity_id);
|
||||
$this->assignconfig('activity_id',$activity_id);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 默认生成的控制器所继承的父类中有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();
|
||||
$activitiIdWhere = [];
|
||||
$param = $this->request->get();
|
||||
if(isset($param['activity_id']) && !empty($param['activity_id'])) {
|
||||
$activitiIdWhere[config('database.prefix').'wdsxh_activity.id'] = array('eq',$param['activity_id']);
|
||||
}
|
||||
$list = $this->model
|
||||
->where($activitiIdWhere)
|
||||
->with(['activity','wechat'])//todo 活动创建后,会员功能对外功能不可用,非会员无法报名
|
||||
->where($where)
|
||||
->order($sort, $order)
|
||||
->paginate($limit);
|
||||
|
||||
$orderModel = new Order();
|
||||
foreach ($list as $row) {
|
||||
$row->order_no = $orderModel
|
||||
->where('activity_id',$row['activity_id'])
|
||||
->where('apply_id',$row['id'])
|
||||
->where('wechat_id',$row['wechat_id'])
|
||||
->value('order_no');
|
||||
if (!empty($row['name'])) {
|
||||
$row->show_field_data = 1;
|
||||
$row->wechat->nickname = $row['name'];
|
||||
$row->wechat->mobile = $row['mobile'];
|
||||
} else {
|
||||
$row->show_field_data = 2;
|
||||
}
|
||||
$pay_time = $orderModel
|
||||
->where('activity_id',$row['activity_id'])
|
||||
->where('apply_id',$row['id'])
|
||||
->where('wechat_id',$row['wechat_id'])
|
||||
->value('pay_time');
|
||||
if (!empty($pay_time))
|
||||
$row->pay_time = date('Y-m-d H:i:s',$pay_time);
|
||||
else {
|
||||
$row->pay_time = '';
|
||||
}
|
||||
}
|
||||
|
||||
$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;
|
||||
}
|
||||
$activityObj = (new \app\admin\model\wdsxh\activity\Activity())->where('id',$params['activity_id'])->find();
|
||||
if (empty($activityObj)) {
|
||||
$this->error('活动不存在');
|
||||
}
|
||||
$current_date = date('Y-m-d',time());
|
||||
$memberObj = (new \app\admin\model\wdsxh\member\Member())->where('wechat_id',$params['wechat_id'])
|
||||
->where('expire_time','>=',$current_date)
|
||||
->find();
|
||||
if ($activityObj['non_member_registration_status'] == '2' && !$memberObj) {
|
||||
$this->error('只有会员才能报名');
|
||||
}
|
||||
if ($activityObj['apply_time'] < time()) {
|
||||
$this->error('活动报名时间已过,无法报名');
|
||||
}
|
||||
if ($activityObj['state'] == '2') {
|
||||
$this->error('活动进行中,无法报名');
|
||||
}
|
||||
if ($activityObj['state'] == '3') {
|
||||
$this->error('活动已结束,无法报名');
|
||||
}
|
||||
$queryActivityApplyObj = (new \app\admin\model\wdsxh\activity\ActivityApply())
|
||||
->where('activity_id',$params['activity_id'])
|
||||
->where('wechat_id',$params['wechat_id'])
|
||||
->where('state','<>','4')
|
||||
->find();
|
||||
if ($queryActivityApplyObj) {
|
||||
$this->error('用户后台已添加或者小程序已报名,请勿重复添加!');
|
||||
}
|
||||
|
||||
if (!empty($activityObj['apply_limit_number']) && $activityObj['apply_limit_number'] > 0) {
|
||||
$apply_count = $this->model->where('activity_id', $params['activity_id'])
|
||||
->where('state',2)
|
||||
->count();
|
||||
if ($apply_count >= $activityObj['apply_limit_number']) {
|
||||
$this->error('活动报名人数已满,无法报名');
|
||||
}
|
||||
}
|
||||
|
||||
if ($activityObj['is_verifying'] == '1') {//活动是否核销:1=是,2=否
|
||||
$is_sign_in = 2;
|
||||
} else {
|
||||
$is_sign_in = 3;//签到:1=已签到,2=未签到,3=无需签到
|
||||
}
|
||||
$member_id = $memberObj ? $memberObj->id : 0;
|
||||
$orderModel = new Order();
|
||||
$avtivityApplyRecordModel = new ActivityApplyRecord();
|
||||
$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);
|
||||
}
|
||||
$apply_data = array(
|
||||
'activity_id'=> $params['activity_id'],
|
||||
'wechat_id' => $params['wechat_id'],
|
||||
'member_id'=>$member_id,
|
||||
'is_sign_in'=>$is_sign_in,
|
||||
'state'=>'2',
|
||||
'createtime' => time(),
|
||||
);
|
||||
$this->model->data($apply_data);
|
||||
$result = $this->model->allowField(true)->save();
|
||||
|
||||
$order_data = array(
|
||||
'activity_id'=> $params['activity_id'],
|
||||
'apply_id'=> $this->model->id,
|
||||
'wechat_id' => $params['wechat_id'],
|
||||
'member_id'=>$member_id,
|
||||
'order_no'=> wdsxh_create_order(),
|
||||
'pay_amount'=>$activityObj['fees'],
|
||||
'channel'=>'3',
|
||||
'paid'=>'2',
|
||||
'pay_time' => time(),
|
||||
'complete_time' => date('Y-m-d H:i:s',time()),
|
||||
'createtime' => time(),
|
||||
);
|
||||
|
||||
$orderModel->data($order_data);
|
||||
$orderModel->allowField(true)->save();
|
||||
|
||||
$avtivity_apply_record_data = array(
|
||||
'activity_id'=> $params['activity_id'],
|
||||
'wechat_id' => $params['wechat_id'],
|
||||
'member_id'=>$member_id,
|
||||
);
|
||||
$avtivityApplyRecordModel->data($avtivity_apply_record_data);
|
||||
$avtivityApplyRecordModel->allowField(true)->save();
|
||||
|
||||
Db::commit();
|
||||
} catch (ValidateException|PDOException|Exception $e) {
|
||||
Db::rollback();
|
||||
$this->error($e->getMessage());
|
||||
}
|
||||
if ($result === false) {
|
||||
$this->error(__('No rows were inserted'));
|
||||
}
|
||||
$this->success();
|
||||
}
|
||||
|
||||
public function multi($ids = null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
public function del($ids = null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
public function edit($ids = null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 报名信息
|
||||
*
|
||||
* @param $ids
|
||||
* @return string
|
||||
* @throws DbException
|
||||
* @throws \think\Exception
|
||||
*/
|
||||
public function field_data_details($ids = null)
|
||||
{
|
||||
$row = $this->model->get($ids);
|
||||
if (!$row) {
|
||||
$this->error(__('No Results were found'));
|
||||
}
|
||||
$custom_content = json_decode($row['field_data'],true);
|
||||
$row['custom_content'] = $custom_content;
|
||||
|
||||
$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', ''));
|
||||
}
|
||||
if (!isset($params['state'])) {
|
||||
$this->error('请选择审核状态');
|
||||
}
|
||||
|
||||
$row = $this->model->get($ids);
|
||||
$result = $row->save(['state'=>$params['state']]);
|
||||
if ($result === false) {
|
||||
$this->error($row->getError());
|
||||
}
|
||||
$this->success('操作成功');
|
||||
}
|
||||
|
||||
}
|
||||
110
application/admin/controller/wdsxh/activity/ActivityConfig.php
Normal file
110
application/admin/controller/wdsxh/activity/ActivityConfig.php
Normal file
@@ -0,0 +1,110 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | 麦沃德科技赋能开发者,助力中小企业发展
|
||||
// +----------------------------------------------------------------------
|
||||
// | Copyright (c) 2017~2024 www.wdadmin.cn All rights reserved.
|
||||
// +----------------------------------------------------------------------
|
||||
// | Wdadmin系统产品软件并不是自由软件,不加密,并不代表开源,未经许可不可自由转售和商用
|
||||
// +----------------------------------------------------------------------
|
||||
// | Author: MY WORLD Team <bd@maiwd.cn> www.wdadmin.cn
|
||||
// +----------------------------------------------------------------------
|
||||
/**
|
||||
* Class ActivityConfig
|
||||
* Desc 活动配置控制器
|
||||
* Create on 2025/4/17 15:09
|
||||
* Create by wangyafang
|
||||
*/
|
||||
|
||||
namespace app\admin\controller\wdsxh\activity;
|
||||
|
||||
|
||||
use app\common\controller\Backend;
|
||||
use think\Db;
|
||||
use think\exception\PDOException;
|
||||
use think\exception\ValidateException;
|
||||
|
||||
class ActivityConfig extends Backend
|
||||
{
|
||||
/**
|
||||
* Config模型对象
|
||||
* @var \app\admin\model\wdsxh\activity\ActivityConfig
|
||||
*/
|
||||
protected $model = null;
|
||||
|
||||
public function _initialize()
|
||||
{
|
||||
parent::_initialize();
|
||||
$this->model = new \app\admin\model\wdsxh\activity\ActivityConfig();
|
||||
$this->view->assign("expiredActivityShowList", $this->model->getExpiredActivityShowList());
|
||||
|
||||
}
|
||||
|
||||
public function config(){
|
||||
$row = $this->model->get(1);
|
||||
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->modelConfig));
|
||||
$validate = is_bool($this->modelValidate) ? ($this->modelSceneValidate ? $name . '.edit' : $name) : $this->modelValidate;
|
||||
$row->validateFailException()->validate($validate);
|
||||
}
|
||||
$result = $row->allowField(true)->save($params);
|
||||
Db::commit();
|
||||
} catch (ValidateException|PDOException|Exception $e) {
|
||||
Db::rollback();
|
||||
$this->error($e->getMessage());
|
||||
}
|
||||
if (false === $result) {
|
||||
$this->error(__('No rows were updated'));
|
||||
}
|
||||
$this->success();
|
||||
}
|
||||
|
||||
public function index()
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
public function edit($ids = null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
public function add()
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
public function del($ids = null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
public function multi($ids = NULL)
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,80 @@
|
||||
<?php
|
||||
|
||||
namespace app\admin\controller\wdsxh\activity;
|
||||
|
||||
use app\common\controller\Backend;
|
||||
/**
|
||||
* 活动电子证书
|
||||
*
|
||||
* @icon fa fa-circle-o
|
||||
*/
|
||||
class ActivityElectronicCertificate extends Backend
|
||||
{
|
||||
|
||||
/**
|
||||
* Party模型对象
|
||||
* @var \app\admin\model\wdsxh\activity\ActivityElectronicCertificate
|
||||
*/
|
||||
protected $model = null;
|
||||
|
||||
public function _initialize()
|
||||
{
|
||||
parent::_initialize();
|
||||
$this->model=new \app\admin\model\wdsxh\activity\ActivityElectronicCertificate();
|
||||
}
|
||||
|
||||
public function index()
|
||||
{
|
||||
$row=$this->model->get(1);
|
||||
if ($this->request->isPost()) {
|
||||
$params=$this->request->param('row/a');
|
||||
|
||||
// 如果params['data']存在,解析它
|
||||
if (isset($params['data']) && !empty($params['data'])) {
|
||||
$data = json_decode($params['data'], true);
|
||||
} else {
|
||||
$data = [];
|
||||
}
|
||||
|
||||
// 重新编码数据
|
||||
$params['data'] = json_encode($data);
|
||||
|
||||
if(empty($row)){
|
||||
\app\admin\model\wdsxh\activity\ActivityElectronicCertificate::create(array('data'=>$params['data']));
|
||||
}else{
|
||||
$row->data=$params['data'];
|
||||
$row->save();
|
||||
}
|
||||
$this->success('保存成功!');
|
||||
}
|
||||
$data=$row->data;
|
||||
if(!empty($data)){
|
||||
$data=json_decode($data,true);
|
||||
}
|
||||
|
||||
|
||||
$this->assign('data',$data);
|
||||
return $this->view->fetch();
|
||||
}
|
||||
|
||||
public function multi($ids = null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
public function del($ids = null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
public function edit($ids = null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
public function add()
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
||||
121
application/admin/controller/wdsxh/activity/ActivityFieldset.php
Normal file
121
application/admin/controller/wdsxh/activity/ActivityFieldset.php
Normal file
@@ -0,0 +1,121 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | 麦沃德科技赋能开发者,助力中小企业发展
|
||||
// +----------------------------------------------------------------------
|
||||
// | Copyright (c) 2017~2024 www.wdadmin.cn All rights reserved.
|
||||
// +----------------------------------------------------------------------
|
||||
// | Wdadmin系统产品软件并不是自由软件,不加密,并不代表开源,未经许可不可自由转售和商用
|
||||
// +----------------------------------------------------------------------
|
||||
// | Author: MY WORLD Team <bd@maiwd.cn> www.wdadmin.cn
|
||||
// +----------------------------------------------------------------------
|
||||
namespace app\admin\controller\wdsxh\activity;
|
||||
|
||||
use app\common\controller\Backend;
|
||||
|
||||
class ActivityFieldset extends Backend
|
||||
{
|
||||
/**
|
||||
* Config模型对象
|
||||
* @var \app\admin\model\wdsxh\activity\ActivityFieldset()
|
||||
*/
|
||||
protected $model = null;
|
||||
|
||||
public function _initialize()
|
||||
{
|
||||
parent::_initialize();
|
||||
$this->model = new \app\admin\model\wdsxh\activity\ActivityFieldset();
|
||||
}
|
||||
|
||||
public function fieldset($ids = null)
|
||||
{
|
||||
$get_fieldset_data = $this->get_fieldset($ids);
|
||||
if ($this->request->isPost()) {
|
||||
$params = $this->request->param('row/a');
|
||||
|
||||
if (empty($params['field']) || !is_array($params['field'])) {
|
||||
$this->error('字段信息不能为空');
|
||||
}
|
||||
$temp = array();
|
||||
|
||||
foreach ($params['field'] as $row) {
|
||||
$temp[] = $row;
|
||||
}
|
||||
$field_array = array_column($temp, 'field');
|
||||
if (count($field_array) != count(array_unique($field_array))) {
|
||||
$this->error('字段名不能重复');
|
||||
}
|
||||
$fieldsetObj = $this->model->where('activity_id',$ids)->find();
|
||||
|
||||
$json = json_encode($temp);
|
||||
if ($fieldsetObj) {
|
||||
$fieldsetObj->json = $json;
|
||||
$fieldsetObj->save();
|
||||
} else {
|
||||
$this->model->save([
|
||||
'activity_id'=>$ids,
|
||||
'json'=>$json
|
||||
]);
|
||||
}
|
||||
$this->success('操作成功!');
|
||||
}
|
||||
$this->assign('get_fieldset_data', json_encode($get_fieldset_data));
|
||||
return $this->view->fetch('');
|
||||
}
|
||||
|
||||
private function get_fieldset($activity_id)
|
||||
{
|
||||
$fieldsetObj = $this->model->where('activity_id',$activity_id)->find();
|
||||
if ($fieldsetObj) {
|
||||
$get_fieldset_data = json_decode($fieldsetObj['json'],true);
|
||||
} else {
|
||||
$get_fieldset_data = array(
|
||||
0 =>
|
||||
array(
|
||||
'show' => '1',
|
||||
'required' => '1',
|
||||
'type' => 'text',
|
||||
'label' => '姓名',
|
||||
'field' => 'name',
|
||||
'option' => '请输入姓名',
|
||||
),
|
||||
1 =>
|
||||
array(
|
||||
'show' => '1',
|
||||
'required' => '1',
|
||||
'type' => 'number',
|
||||
'label' => '手机号',
|
||||
'field' => 'mobile',
|
||||
'option' => '请输入你的手机号',
|
||||
),
|
||||
);;
|
||||
}
|
||||
|
||||
return $get_fieldset_data;
|
||||
|
||||
}
|
||||
|
||||
public function index()
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
public function multi($ids = null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
public function del($ids = null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
public function edit($ids = null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
public function add()
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,72 @@
|
||||
<?php
|
||||
|
||||
namespace app\admin\controller\wdsxh\activity;
|
||||
|
||||
use app\common\controller\Backend;
|
||||
/**
|
||||
* 活动电子证书
|
||||
*
|
||||
* @icon fa fa-circle-o
|
||||
*/
|
||||
class CertificateDesign extends Backend
|
||||
{
|
||||
|
||||
|
||||
|
||||
public function _initialize()
|
||||
{
|
||||
parent::_initialize();
|
||||
}
|
||||
|
||||
public function index($ids = null)
|
||||
{
|
||||
$row=(new \app\admin\model\wdsxh\activity\Activity())->get($ids);
|
||||
if ($this->request->isPost()) {
|
||||
$params=$this->request->param('row/a');
|
||||
|
||||
// 如果params['data']存在,解析它
|
||||
if (isset($params['data']) && !empty($params['data'])) {
|
||||
$data = json_decode($params['data'], true);
|
||||
} else {
|
||||
$data = [];
|
||||
}
|
||||
|
||||
// 重新编码数据
|
||||
$params['data'] = json_encode($data);
|
||||
|
||||
$row->certificate_data=$params['data'];
|
||||
$row->save();
|
||||
|
||||
$this->success('保存成功!');
|
||||
}
|
||||
$data=$row->certificate_data;
|
||||
if(!empty($data)){
|
||||
$data=json_decode($data,true);
|
||||
}
|
||||
|
||||
|
||||
$this->assign('data',$data);
|
||||
return $this->view->fetch('admin@wdsxh/activity/activity_electronic_certificate/index');
|
||||
}
|
||||
|
||||
public function multi($ids = null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
public function del($ids = null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
public function edit($ids = null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
public function add()
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
||||
218
application/admin/controller/wdsxh/activity/Refund.php
Normal file
218
application/admin/controller/wdsxh/activity/Refund.php
Normal file
@@ -0,0 +1,218 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | 麦沃德科技赋能开发者,助力商协会发展
|
||||
// +----------------------------------------------------------------------
|
||||
// | Copyright (c) 2017~2024 www.wdsxh.cn All rights reserved.
|
||||
// +----------------------------------------------------------------------
|
||||
// | 沃德商协会系统并不是自由软件,不加密,并不代表开源,未经许可不可自由转售和商用
|
||||
// +----------------------------------------------------------------------
|
||||
// | Author: MY WORLD Team <bd@maiwd.cn> www.maiwd.cn
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\admin\controller\wdsxh\activity;
|
||||
|
||||
use addons\wdsxh\library\Wxapp;
|
||||
use app\admin\model\wdsxh\activity\Order;
|
||||
use app\admin\model\wdsxh\user\Wechat;
|
||||
use app\common\controller\Backend;
|
||||
use think\Db;
|
||||
use think\exception\PDOException;
|
||||
use think\exception\ValidateException;
|
||||
use Exception;
|
||||
|
||||
/**
|
||||
* 活动退款
|
||||
*
|
||||
* @icon fa fa-circle-o
|
||||
*/
|
||||
class Refund extends Backend
|
||||
{
|
||||
|
||||
/**
|
||||
* Refund模型对象
|
||||
* @var \app\admin\model\wdsxh\activity\Refund
|
||||
*/
|
||||
protected $model = null;
|
||||
|
||||
public function _initialize()
|
||||
{
|
||||
parent::_initialize();
|
||||
$this->model = new \app\admin\model\wdsxh\activity\Refund;
|
||||
$this->view->assign("stateList", $this->model->getStateList());
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 默认生成的控制器所继承的父类中有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(['wechat','activity','order'])//todo 活动创建后,会员功能对外功能不可用,非会员无法报名
|
||||
->where($where)
|
||||
->order($sort, $order)
|
||||
->paginate($limit);
|
||||
|
||||
foreach ($list as $row) {
|
||||
|
||||
|
||||
}
|
||||
|
||||
$result = array("total" => $list->total(), "rows" => $list->items());
|
||||
|
||||
return json($result);
|
||||
}
|
||||
return $this->view->fetch();
|
||||
}
|
||||
|
||||
/*
|
||||
* 同意退款
|
||||
*/
|
||||
public function agree($ids=null){
|
||||
$refundObj = $this->model->get($ids);
|
||||
if(!$refundObj){
|
||||
$this->error('退款信息不存在');
|
||||
}
|
||||
$wechatObj = (new Wechat())->get($refundObj->wechat_id);
|
||||
if(!$wechatObj){
|
||||
$this->error('用户信息不存在');
|
||||
}
|
||||
|
||||
$orderWhere = array(
|
||||
'activity_id'=>$refundObj->activity_id,
|
||||
'apply_id'=>$refundObj->apply_id,
|
||||
'wechat_id'=>$refundObj->wechat_id,
|
||||
'id'=>$refundObj->order_id,
|
||||
'paid'=>'2'
|
||||
);
|
||||
$applyWhere = array(
|
||||
'activity_id'=>$refundObj->activity_id,
|
||||
'wechat_id'=>$refundObj->wechat_id,
|
||||
'state' =>'3',
|
||||
'id'=>$refundObj->apply_id,
|
||||
);
|
||||
|
||||
$applyObj = \app\admin\model\wdsxh\activity\ActivityApply::where($applyWhere)->find();
|
||||
if (!$applyObj) {
|
||||
$this->error('报名没有查询到退款记录');
|
||||
}
|
||||
$orderObj = (new Order())->where($orderWhere)->find();
|
||||
if(!$orderObj){
|
||||
$this->error('支付订单信息不存在');
|
||||
}
|
||||
|
||||
$refund_no = wdsxh_create_order();
|
||||
|
||||
$res=Wxapp::payRefund($orderObj->order_no,$refund_no,$orderObj->pay_amount,array('refund_desc'=>'活动报名退款'));
|
||||
if($res && $res['return_code'] == 'SUCCESS' && $res['result_code'] == 'SUCCESS'){
|
||||
$result = false;
|
||||
Db::startTrans();
|
||||
try {
|
||||
$refundObj->state = '2';
|
||||
$refundObj->dispose_time = time();
|
||||
$result = $refundObj->save();
|
||||
$orderObj->refund_no = $refund_no;
|
||||
$orderObj->refund_time = time();
|
||||
$orderObj->paid = '3';
|
||||
$orderObj->save();
|
||||
$applyObj->state = '4';
|
||||
$applyObj->save();
|
||||
Db::commit();
|
||||
} catch (ValidateException|PDOException|Exception $e) {
|
||||
Db::rollback();
|
||||
$this->error($e->getMessage());
|
||||
}
|
||||
if ($result === false) {
|
||||
$this->error(__('No rows were inserted'));
|
||||
}
|
||||
$this->success('退款操作成功');
|
||||
}else{
|
||||
$this->error('退款失败,错误信息:'.$res['err_code_des']);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* 拒绝退款
|
||||
*/
|
||||
public function refuse($ids=""){
|
||||
if (false === $this->request->isPost()) {
|
||||
return $this->view->fetch();
|
||||
}
|
||||
|
||||
$refundObj = $this->model->get($ids);
|
||||
if(!$refundObj){
|
||||
$this->error('退款信息不存在');
|
||||
}
|
||||
|
||||
$applyWhere = array(
|
||||
'activity_id'=>$refundObj->activity_id,
|
||||
'wechat_id'=>$refundObj->wechat_id,
|
||||
'state' =>'3',
|
||||
'id'=>$refundObj->apply_id,
|
||||
);
|
||||
$applyObj = \app\admin\model\wdsxh\activity\ActivityApply::where($applyWhere)->find();
|
||||
if (!$applyObj) {
|
||||
$this->error('报名没有查询到退款记录');
|
||||
}
|
||||
$params = $this->request->post('row/a');
|
||||
|
||||
$result = false;
|
||||
Db::startTrans();
|
||||
try {
|
||||
$refundObj->state = '3';
|
||||
$refundObj->dispose_time = time();
|
||||
$refundObj->reject = $params['reject'];
|
||||
$result = $refundObj->save();
|
||||
$applyObj->state = '5';
|
||||
$applyObj->save();
|
||||
Db::commit();
|
||||
} catch (ValidateException|PDOException|Exception $e) {
|
||||
Db::rollback();
|
||||
$this->error($e->getMessage());
|
||||
}
|
||||
if ($result === false) {
|
||||
$this->error(__('No rows were inserted'));
|
||||
}
|
||||
$this->success('操作成功');
|
||||
}
|
||||
|
||||
public function multi($ids = null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
public function del($ids = null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
public function edit($ids = null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
public function add()
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user