123456789101112131415161718192021222324252627282930313233343536373839 |
- <?php
- namespace Goods\Lib;
- use Dever;
- class Coupon
- {
- public function get_api()
- {
- $level_total = 2;
- # 当前联动级别
- $level_num = Dever::input('level_num');
- # 一般为id
- $level_id = Dever::input('level_id');
- if ($level_num == 1) {
- $method = Dever::db('goods/coupon')->config['method'];
- foreach ($method as $k => $v) {
- if ($k != 1) {
- $data[] = array('value' => $k, 'name' => $v);
- }
- }
- } elseif ($level_num == 2) {
- $data = Dever::db('goods/coupon')->getAll(array('method' => $level_id));
- }
- if (!$data) {
- Dever::alert('error');
- }
- $result['level_total'] = $level_total;
- $result['list'] = $data;
- return $result;
- }
- }
|