发表日期: 2021-04-27 08:53:03 浏览次数:95
邳州400电话办理【邳州网站公司】邳州百度优化、邳州域名注册、邳州网店美工、邳州微信公众号托管
邳州,简称“邳”,江苏省徐州市代管县级市, [1-2] 古称良城、邳国、下邳、邳县,位于苏鲁交界,东接新沂市,西连徐州市铜山区、贾汪区,南界睢宁县,北邻山东省兰陵县。 [3] 1992年撤县设市。
邳州历史悠久,境内大墩子文化遗址距今6000年,是江苏文明最早的起源之一。境内有邳州市艾山风景名胜区、沙沟湖水杉公园、国家银杏博览园、小萝卜头纪念馆等旅游景点。邳州的城市精神是“创新、争先、开放、包容”。 [4]
邳州发展的目标是东陇海产业带重要的水陆交通枢纽、新兴工贸城市,京杭运河沿岸具有水乡特色和历史文化底蕴的生态宜居城市。
2019年7月,邳州入选国家知识产权强县工程试点县(区)。2019年,邳州位居全国综合实力百强县市第37位、经济竞争力百强第40位、全国投资潜力百强县市第18位、全国绿色发展百强县市第33位、全国科技创新百强县市第36位、全国新型城镇化质量百强县市第51位。
-- Family-2.0$ vim ./Data/sweight.sql `user_id` bigint(20) DEFAULT NULL, `weight` int(7) DEFAULT '0' COMMENT '体重(单位用g)', `report_date` int(11) DEFAULT '0' COMMENT '体重上报时间戳', `type` tinyint(2) DEFAULT '0' COMMENT '体重阶段:0普通人/产前,1孕妇,2抱婴(产后)', `baby_position` tinyint(4) DEFAULT '0' COMMENT '宝宝的位置,1老大,2老二,3老三(为0时表示不是宝宝的体重)', `report_short_date` varchar(8) DEFAULT '' COMMENT '短的日期,格式如:20150501', `cur_day_position` smallint(3) DEFAULT '1' COMMENT '当天上报第几次上报',复制代码
再来稍微看一下在上传体重数据时,是怎样的一个过程。下面是上传体重接口服务对应的Api接口层的代码片段。
// Family-2.0$ vim ./Apps/Scale/Api/Device/Scale.phpclass Api_Device_Scale extends PhalApi_Api {
public function getRules() {
return array(
'uploadWeight' => array(
'weight' => array('name' => 'weight', 'type' => 'int', 'min' => 0, 'max' => 250000, 'default' => 0, 'require' => true),
'type' => array('name' => 'type', 'type' => 'enum', 'range' => array(0, 1, 2), 'default' => 0, 'require' => true),
'babyPosition' => array('name' => 'baby_position', 'type' => 'int', 'default' => 0, 'require' => false),
'babyWeight' => array('name' => 'baby_weight', 'type' => 'int', 'min' => 0, 'max' => 250000, 'default' => 0, 'require' => false),
),
);
}}复制代码上面配置的参数规则中,weight表示待上服的体重数据。再来看下实现代码。
public function uploadWeight() {
$rs = array('code' => Common_Def::CODE_OK, 'msg' => '');
if ($this->type != 2 && $this->babyPosition != 0) {
throw new PhalApi_Exception_BadRequest(T('baby position is not 0'));
}
DI()->userLite->check(true);
$domain = new Domain_SWeight();
$domain->addWeight($this->userId, $this->weight, $this->type, $this->babyPosition, $this->babyWeight);
if ($this->type == 1) {
// 设置最新的体重(type为1时,表示孕妇的,妈妈的数据是存在 smother 表里;type为2时,妈妈的数据是存在 suser 表里)
$motherDomain = new Domain_SMotherInfo();
$motherDomain->initDefaultUserDataIfNoUserData($this->userId);
if ($this->weight > 0) {
$motherDomain->freeUpdate($this->userId, array('newest_weight' => $this->weight));
}
} else {
// 设置最新的体重(type为1时,表示孕妇的,妈妈的数据是存在 smother 表里;type为2时,妈妈的数据是存在 suser 表里)
$commonDomain = new Domain_SInfo();
$commonDomain->initDefaultUserDataIfNoUserData($this->userId);
if ($this->weight > 0) {
$commonDomain->freeUpdate($this->userId, array('newest_weight' => $this->weight));
}
}
if ($this->type == 2) {
// 设置宝宝最新的体重
$babyDomain = new Domain_SBabyInfo();
$babyDomain->initDefaultUserDataIfNoUserData($this->userId, $this->babyPosition);
if ($this->babyWeight > 0) {
$babyDomain->freeUpdate($this->userId, $this->babyPosition, array('newest_weight' => $this->babyWeight));
}
}
return $rs;
}复制代码通过区分不同的体重类型,然后将体重数据保存到相应的位置,并且会用户初次上传体重数据时,进行前置的初始化操作。至此,我们就完成了体重这一基础数据的服务构建。接下来,是基于这份数据而衍生出来更复杂的业务。
在前面,我们介绍了如何通过ADM分层模式有效地消化复杂的领域业务。这对于一般性的复杂业务是可行的,但对于特定的复杂业务,则需要适当地采用设计模式,方能有效进行解决。那何谓特定的复杂业务呢?这里的定义比较笼统,可以理解成设计模式所解决的重复性问题,也可以理解成是业务系统中比较关键、变化较多、规则繁重的区域。以Family 2.0 系统中的推送为例,有两大类推送服务,一类是周期固定的主动推送,如每日推送、每周推送和每月推送;另一类是特定场景下的触发推送,如新注册用户推送。最终总结得出,需要的推送接口服务有以下这些:
