GlobalAction::doEditCredit PHP Метод

doEditCredit() публичный Метод

public doEditCredit ( )
    public function doEditCredit()
    {
        $name = trim($_POST['name']);
        if ($name == '' && $_POST['name'] != '') {
            $this->error('名称不能为空格');
        }
        if (!$this->__isValidRequest('id,name')) {
            $this->error('数据不完整');
        }
        $_POST = array_map('t', $_POST);
        $_POST = array_map('h', $_POST);
        $creditType = M('credit_type')->order('id ASC')->findAll();
        foreach ($creditType as $v) {
            if (!is_numeric($_POST[$v['name']])) {
                $this->error($v['alias'] . '的值必须为数字!');
            }
        }
        $_LOG['uid'] = $this->mid;
        $_LOG['type'] = '3';
        $data[] = '全局 - 积分配置 - 积分规则 ';
        $credit_info = M('credit_setting')->where('id=' . $_POST['id'])->find();
        $data[] = $credit_info;
        $_POST['info'] = $credit_info['info'];
        if ($_POST['__hash__']) {
            unset($_POST['__hash__']);
        }
        $data[] = $_POST;
        $_LOG['data'] = serialize($data);
        $_LOG['ctime'] = time();
        M('AdminLog')->add($_LOG);
        $id = $_POST['id'];
        unset($_POST['id']);
        $res = M('credit_setting')->where('id=' . $id)->save($_POST);
        // dump(D()->getLastSql());exit;
        if ($res !== false) {
            // 清缓存
            F('_service_credit_rules', null);
            $this->assign('jumpUrl', U('admin/Global/credit'));
            $this->success('保存成功');
        } else {
            $this->error('保存失败');
        }
    }