AdminReturnMoneyController.php 2.7 KB
<?php
// +----------------------------------------------------------------------
// | bronet [ 以客户为中心 以奋斗者为本 ]
// +----------------------------------------------------------------------
// | Copyright (c) 2013-2017 http://www.bronet.cn All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: 老猫 <bronet@126.com>
// +----------------------------------------------------------------------
namespace app\portal\controller;

use app\portal\model\ArtModel;
use app\portal\model\DepositScoreModel;
use cmf\controller\AdminBaseController;
use think\Db;
use think\Loader;


/**
 * Class AdminReturnMoney
 * @package app\portal\controller
 * @adminMenuRoot(
 *     'name'   =>'门店返佣比例设置',
 *     'action' =>'default',
 *     'parent' =>'',
 *     'display'=> true,
 *     'order'  => 30,
 *     'icon'   =>'th',
 *     'remark' =>'门店返佣比例设置'
 * )
 */
class AdminReturnMoneyController extends AdminBaseController
{
    /**
     * 门店返佣比例设置
     * @adminMenu(
     *     'name'   => '门店返佣比例设置',
     *     'parent' => 'portal/AdminReturnMoney/default',
     *     'display'=> true,
     *     'hasView'=> true,
     *     'order'  => 10000,
     *     'icon'   => '',
     *     'remark' => '门店返佣比例设置',
     *     'param'  => ''
     * )
     */
    public function index(){
        $where_coo['status'] = 1;
        $coo_list = Db::name('ReturnMoney')->where($where_coo)->find();
        $this->assign('list',$coo_list);
        return $this->fetch('view');
    }


    /**
     * 修改门店返佣比例
     * @adminMenu(
     *     'name'   => '修改门店返佣比例',
     *     'parent' => 'index',
     *     'display'=> false,
     *     'hasView'=> true,
     *     'order'  => 10000,
     *     'icon'   => '',
     *     'remark' => '修改门店返佣比例',
     *     'param'  => ''
     * )
     */
    public function edit()
    {
        $data = $this->request->param();
        if(empty($data['money'])){
            $this->error('返佣比例不能为空');
        }else{
            if(is_numeric($data['money'])){
                $this->error('返佣比例不能为空');
            }
            $save['money'] = $data['money'];
            $save['create_time'] = time();
            $save['update_time'] = time();
            $where['id'] = $data['id'];
            $res = Db::name('ReturnMoney')->where($where)->update($save);
            if($res){
                $this->success('修改成功');
            }else{
                $this->error('修改失败');
            }
        }
    }



}