swap自动交易机器人代码呈现案列讲解:
代码语言:javascript复制 public function cattype()
{
$result = array('code' => 0, 'msg' => '', 'data' => array('list' => null));
$this->_checkOpen();
// if (!IS_POST) {
// $result['msg'] = '非法请求';
// $this->ajaxReturn($result);
// }
$type_id = I('typeid', '0', 'intval');
$level = I('level', 'self'); //self 自己(默认),top 顶级,parent父级
$num_flag = I('numflag', 0, 'intval'); //显示对应文档数
$field_flag = I('fieldflag', 0, 'intval'); //显示content
$field_flag = empty($field_flag) ? 0 : 1;
$_category_all = get_category(0);
if ($level == 'parent') {
$cattype = Category::getParent($_category_all, $type_id, 1);
} else if ($level == 'top') {
$cattype = Category::getParent($_category_all, $type_id, 2);
} else {
$cattype = Category::getSelf($_category_all, $type_id);
}
if (!empty($cattype)) {
$cattype['url'] = get_url($cattype);
$cattype['url'] = $this->getCateUrl($this->is_mobile, $cattype, false, ''); //($catlist);
if (isset($cattype['cat_pic'])) {
if (empty($cattype['cat_pic'])) {
$cattype['cat_pic'] = '';
} else if (stripos($cattype['cat_pic'], 'http://') === false && stripos($cattype['cat_pic'], 'https://') === false) {
$cattype['cat_pic'] = $this->getDomain() . $cattype['cat_pic'];
}
}
if ($num_flag) {
$cattype['arc_num'] = get_category_count($cattype['id']);
} else {
$cattype['arc_num'] = 0;
}
if ($field_flag) {
$cattype['content'] = M('Category')->where(array('id' => $cattype['id']))->getField('content');
}
} else {
$cattype = null;
}
$result['code'] = 1;
$result['data']['list'] = $cattype;
$this->ajaxReturn($result);
}
swap自动交易机器人是如何完成工作的,通过什么样的方式来实现功能,要怎么样才能够最大化的发挥他的能力已经功能,以上代码知识一部分内容,需要大家更加详细的去开挖掘。